0

Is there any way to make a column that records the last field that was modified for each item?

(I know this is visible in the item's version history but we need to able to see it without navigating away from the list/item)

1

There is not such standard functionality, so the only way to create this functionality is custom development. I can suggest following approaches.

Create additional text column, called "Last modified columns", create event receiver, and handle item updating event. You can compare field values in event receiver, then fill value of "Last modified columns" with names of last modified columns. It is possible that multiple columns will be changed simultaneously, so you need to store names of all changed columns.

Another approach is to create custom field, which will read and analyze versions history of list item and display names of changed columns.

For second approach you can access versions collection of SPListItem like this:

SPListItem listItem = //get list item here

int i = 0;
//Then you can iterate through versions and do what you need
foreach (SPListItemVersion version in listItem.Versions)
{
  //Get field value from version like this.
  //Replace "FieldInternalName" with your field name
  string fieldValue = listItem.Versions[i]["FieldInternalName"].ToString();
  i++;
}
  • Thanks Anton Kh. Any suggestions on how to go about your second approach? – user111023 Aug 2 '13 at 7:34
  • Hi, I updated my answer with small code sample. Hope it will help you. – Anton Khritonenkov Aug 3 '13 at 5:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.