Skip to main content
Solved

Calculate the number of days a request has stayed in a particular state

  • 23 May 2024
  • 3 replies
  • 56 views

Hi All, How do we set up workflow rule / Custom field which can calculate the number of days a request has been sitting in a particular phase, for example I am trying to figure out the number of days a RISK/ISSUE has been staying in Active state

There’s a few ways for this depending on how often it’s needed

  1. If it’s a once off, or you only need to do this infrequently I’d just be using the Change History, and add a filter for “Field Name” then filter on the Active state, and you can see the changed on date
  2. If you need to know JUST the number of days in the current state - then create a custom API only number field for State Start Date, set that on state change in workflow rule, then another custom API only number field to set that State Day Count via workflow rule which does a datediff on the State Start Date and today.
  3. If you need this number regularly, and want a “Number of days in X State” then I’d create a custom API only number field for each State I needed to track. Then create a workflow rule that uses evaluation criteria something like “(IsChanged($State) && $State <> null)”.  Then have a bunch of “Conditional Action List” IF statements that say if Active, then set each one and calculate all the days. (kind of like a recursive B above)

Hope this makes sense.  Let me know if you have any other questions.


Hi Mayank - Andy gave excellent advice! I would add to that you can have this counter with the custom field that Andy mentioned (days at Active) and I would use a SWFR that runs over night. If the case is in an Active state, I would have the SWFR count the days at Active up by one. If the case state is not in an Active state, the SWFR can clear the count field entirely or skip over that record as the conditions to run do not apply. 


Hi @Andy Johnston and @CortFelix , Thank you for the suggestions will try this at my end and reach out in case of any questions!


Reply