function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
bjacobbjacob 

Calculate time since case is opened in depedency of state

Hi there,

it's my objective to create a new field "SLA Timer". This field calculates the time since the case is created. The calculation depends on some conditions:
  • The timer stops as soon as the status of a case is changed to a specific state. There are 3 status which will stop the timer (say status x, y, z). The timer will also stop if the case is closed.
  • The timer starts as soon as the status is changed to another state which is not one of the 3 status mentioned above (x, y, z).
  • Furtermore the script has to check our business hours. The timer only runs within our business hours.
The whole day I've tried to create a formula field which calculates the time. I think it's not that easy because I need a lot of additional fields. Also I'm not sure if it's the best way to use the formula language.

Thanks for any help, Bjoern
Best Answer chosen by Admin (Salesforce Developers) 
Jeff TalbotJeff Talbot
The "Case Duration in business hours" feature is apparently in pilot and available by requesting it from Support.
Not sure if it will handle your need to run the timer depending on the status, but I do know that was one of the suggestions when this feature request was originally being reviewed by SF in the middle of last year. If you get into the pilot, let us know what you find. I'm also interested in a Case timer that is stage dependant.

All Answers

Jeff TalbotJeff Talbot
The "Case Duration in business hours" feature is apparently in pilot and available by requesting it from Support.
Not sure if it will handle your need to run the timer depending on the status, but I do know that was one of the suggestions when this feature request was originally being reviewed by SF in the middle of last year. If you get into the pilot, let us know what you find. I'm also interested in a Case timer that is stage dependant.
This was selected as the best answer
MiguelGuerreiroMiguelGuerreiro
Hello,
 
I have the same problem in my org, calculation accurate SLA's.
 
This should be simple for salesforce because they already have a business hours "setting" but it's only used for escalation rules. So the case age should be calculated using those business hours.
 
To get the duration spent in each state or owner you can run a historical report.
 
Miguel