SharePoint Stack Exchange is a question and answer site for SharePoint enthusiasts. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

How do I capture date and time when status of task is changed?

I have 3 different columns Date Assigned, Date In Progress, Date Completed.

When a task is assigned to a user, is there a way Date assigned column gets the date & time automatically? If yes, how do we do?

Similarly when user changes task to In Progress state, Date In Progress should get date & time & similarly when task is closed by user, Date Completed column should get the time-stamp, so that I can calculate time taken for each task and status in between.

I am using SharePoint 2010.

share|improve this question

You need a item event handler, something like this:

   public override void ItemUpdated(SPItemEventProperties properties)
   {
      if(properties.BeforeProperties["Status"]!=properties.AfterProperties ["Status"]){
         properties.ListItem["Date In Progress"]=DateTime.Now;
       }
   }
share|improve this answer
    
Let's add some null checks to the Before and After properties too – Robert Lindgren May 2 '13 at 10:15

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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