Preserving Modified date on list items

Category: sharepoint 2010 customization

Question

Albini's cat on Thu, 29 Jun 2017 09:43:30


Hi there, I wonder if you can help me here.

How would I preserve the Modified date when a list item is changed?

I’m trying to create an archiving solution* using a workflow to copy older items to a second list, as follows:

I have two lists, each with identical columns. A workflow running on the first list sets LastModified column to the Modified date.

Archive Date is a calculated column which adds 30 days to the created date (=created+30).

The workflow has a Pause command so when the Archive Date is reached the item is copied to the second list archiving items older than 30 days.

The workflow then deletes the original item on the main list.

When the item is copied, the original created date won’t be retained on the second list – to preserve this, the created date is saved to an ‘original creation date’ field via the workflow.

[*The archiving could be done through a list retention policy – however I can’t get this to work, either by moving items to the recycle bin or by triggering a workflow from the retention policy to copy items to a second list]

The workflow is set to run on created and changed.

Do you have any suggestions how to preserve the Modified date?

Thanks!

Replies

croute1 on Fri, 30 Jun 2017 13:06:05


Hi Albini's cat: watch out for those dogs ;)

The quick answer is that you can't. However, I'd suggest copying the date to another column (either date or text) and use that as your modified date instead.

romeo donca on Fri, 30 Jun 2017 13:39:50


Hi

another aproach

if you enable versioning you will have the changes and the dates as well

a scheduled powershell script, whill check which items need to be copied in the secondary list, and this script will copy the versioning as well

Albini's cat on Fri, 30 Jun 2017 16:14:41


Thanks cameron.

I have tried that, however if I set the LastModified value to the Modified date thorough either a workflow or a calculated formula this will only update it to the time it was modified, so this doesn't solve this.

Do you have any suggestions to get round this?

Albini's cat on Fri, 30 Jun 2017 16:16:48


thanks Romeo.

I did consider Version history.  It's one possibility.  Versioning is turned on on the list.

I would prefer not to use PowerShell as I want to process to be automatic, with no additional intervention.

Do you have any suggestions how to schedule a PowerShell script to run?

croute1 on Fri, 30 Jun 2017 17:08:34


Why not use a workflow variable to store the date?

Albini's cat on Mon, 03 Jul 2017 08:11:23


Hi cameron.

As soon as the workflow runs, any attempt to store the modified date either as a variable or as another column value sets it to the time the workflow runs.

Dean_Wang on Mon, 03 Jul 2017 08:28:39


Hi,

You can copy the LastModified column value from ListA to ListB. And in ListB, you can set the workflow which updates the LastModified column to be triggered when an item is changed. After that, the LastModified column value won’t be updated when a new item is created in ListA.

Thanks,

Dean Wang