How to get a calculated field with modify date, when one field or column changes in the share point list.

For example, If I have a field status, i should get a modify field populated with today's date whenever I change the status field. The date column should not change in case of changes in the other column other than status column.

Please help me ...

UPDATE Event Reciever code I tried..

public override void ItemUpdating(SPItemEventProperties properties)

           string currentStatus = properties.ListItem["Status"].ToString();
           string newStatus = properties.AfterProperties["Status"].ToString();

           if (currentStatus != newStatus)
               SPListItem oItem = properties.ListItem;
               oItem["Last Modified"] = "Hi";



<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <Receivers ListTemplateId="120">


ListTemplateId="120" (Because - List is of type DataSheet List).

However getting a conflict like - Rows you changed were previously changed by (My User Name) on ...... Your chnages conflict with that users change.

This I believe because of the update command in the Reciever. How can I get rid of this - Though the column 'Last Modified' is populating correctly ....


I think you can't update Item in ItemUpdating method, that will triger Recursion updating. As described in this question/answer: https://stackoverflow.com/questions/3065881/how-to-change-a-field-value-during-the-itemupdating-event.

So, my solution is: do it at client side. Write some JQuery code in your page to monitor the status field's value. Only when it changes, you sent your hidden "Last Modified" field value with the current date by JQuery like $("#your_field_id").attr("value",now);

You can use SharePoint Designer to customize your list's Edit Form to hide the "Last Modified" field, thus you can prevend from manually changing the date.

  • Thank you jony, however I am really bad in Jquery, any ways looks like there is no other way I can do it. Thanks for explaining this... – Jithu Nov 15 '11 at 6:03

if you change this field through code you can try to use SPListItem.SystemUpdate method.

public override void ItemUpdating(SPItemEventProperties properties)

       if (properties.BeforeProperties["Status"]!= properties.AfterProperties["Status"])
           properties.AfterProperties["Modified"] = properties.BeforeProperties["Modified"];

  • Hi Alex, Thank you for your help. However I am using the Data Sheet Type of list. So Can I write a code when ever the user changes the content in the status column - Update Calculated list? Please help? – Jithu Nov 11 '11 at 9:02
  • Try to add list item event receiver to your list. In this receiver you can override ItemUpdating method. In this method you can check what field is modified, if this field is status you can try to use two approachs: use 'properties.Cancel = true' to stop item updating and invoke SystemUpdate; set 'properties.AfterProperties["Modified"] = properties.BeforeProperties["Modified"]' (This should work properly). – Alexander Nov 11 '11 at 10:32
  • Please have a look at the updated question.. – Jithu Nov 11 '11 at 11:29
  • I have edited code in your question. But there is a small problem. If the user changes several fields and one of them is a status field, the modified field was not changed. you should check fields that can be edited by user. it is my first time when I edit question.. so I don't know when you see changes ( – Alexander Nov 11 '11 at 11:47
  • HI Alex, I dint see any edit in the question . You can just copy the code and update in your answer. Thank you!! – Jithu Nov 11 '11 at 11:54

I would write an event handler (SPItemEventReceiver) to do this, and then register it against my list.

  • Thank you for your suggestion, Please have a look at the updated question.. – Jithu Nov 11 '11 at 11: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.