+ Start a Discussion
bhanu_prakashbhanu_prakash 

Case status track time

How can we track case status timing 
1. Every time case status got changed 
2. If case status is changed to previous also add to previous time
Ex : case status - assigned to working at 11:00 to 12:00 (changed to working) under assigned 1hr
12:00 to 1:00 (changed to assign )
Need to show 
Working as 1hr and assigned as 2hrs

How can we achieve it ?

Thanks for advance
 
Timothy Gentet O'BrienTimothy Gentet O'Brien
You will need to either have a lot of fields to track this, or you will need to have a custom object that is a child of the Case.

I would recommend the latter, as you can utilise this in a Lightning Component or Visualforce page on the actual Case itself to show users what is going on.

What you would need to do for this is:
  1. A new Custom Object ("Status Tracking" or something along those lines).
  2. A few new fields on the Custom Object.
    1. Case - Lookup to the Case Object.
    2. Created Date - Already a field, but thought I would mention the use of it!
    3. Original Status - Picklist which mirrors the Case Status or a Text field which can just be updated with the Status anyway.
    4. Change to Status - Same as above.
    5. Change Date - Date/Time field.
    6. Time Different - Formula field that outputs the Unit of time that has been tracked.
  3. A Process Builder - on the case object that is triggered off of Case insert and update.
Process:
  1. On Creation of a Case create a new "Status Tracking" record.
    1. As with all records, this will be automatically timestamped with the Created Date so you will not need to store this anywhere.
    2. You will need to put the status in a "Original Status" field.
  2. On change of the Case status, you will need to use a Process Builder to update child records, Salesforce have some documentation on how to do that here: https://help.salesforce.com/articleView?id=000213419&language=en_US&type=1, from this you will need 1 actions.
    1. Update "Status Tracking" record previously created.
      1. You will need to search where the "Original Status" equals the PRIORVAUE() formula function, this will allow you to find out what the value was before it was changed.
      2. You will need to Timestamp a new field "Change Date".
      3. A third field will be a Formula which will calculate the difference in time between the 2 fields - I will leave this for you to work out!
      4. Optional - It's an optional idea to actually put the new value into this record as well, this way you can actually use this for more solid reporting further down the line.
    2. Create new "Status Tracking" record.
      1. You will need to use the Process builder in a separate action to then create a new "Status Tracking" record.
      2. This will only contain the new Status that needs to now be tracked.
Once you have done this process it should then auto create and update records as and when needed, meaning you can then track everything really nicely! A Lightning Component after this would be pretty swish, you could display all Status changes and times in it by querying the children and displaying them in a nice way!