I Need to get the amount of time a user spent on a particular case. How can I get this? Someone please help

  • 1
    The standard way to achieve it is to calculate the period of time between case closed and case open. If the standard way can not work for you, what it can not? List them, and it will be good starting points to achieve your goal.
    – Cray Kao
    May 17, 2016 at 12:54
  • 1
    Please can you clarify what your use case is that you cannot do this with standard functionality. Also please read the guidelines on how to ask questions salesforce.stackexchange.com/help/how-to-ask
    – Dave Humm
    May 17, 2016 at 12:59

3 Answers 3


I had done following for a POC once. See if this work for your business requirement.

  1. Create a new child object for case to log time spent on case. Fields can include UserId, StartTime, EndTime, Duration etc.

  2. Write two webservice methods in a class named starttimer() and endtimer(). StartTimer will create a new record in object create in step1 with empty EndTime. Stoptimer() will populate EndTime in record that has empty EndTime. At a time there should be only one record associated to Case with empty EndTime.

  3. Create two custom button on Case object to call web service methods created in step 2.

  4. Place these two button on case object layout.


If you implement Omni-Channel, there is a new feature coming in Summer '16 release that will let you track handle time and active time on a work item.


Create two custom fields in the Case object to store a DateTime value each. One for when the person starts working on the case, and other for when the case status is set to 'closed'. You need the first field because you want to check the time when the person starts working on the case, not when the case is created (in this case you would want to use the standard field CreatedAt).

You can populate both of those fields with workflow rules, and then have a formula field that calculates the time between those two dates. When the case is being worked on, you won't have the second field, so you won't be able to calculate the time, or you will want to set the formula to calculate the amount of time passed between the first field and the current time.

  1. Create field for when the agent starts working on the case.
  2. Create field for when the agent closes the case.
  3. Create formula field to calculate the time between those two.
  • 1
    in addition to this, formula field would be like for hour unit: (CloseDate - CreatedDate) * 24 But if you want to calculate , how many business hours , they spent on particular case, you may have to use business hour object. May 17, 2016 at 14:50

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .