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
SeanOSeanO 

Workflow rule for capturing how long something has been in a certain status

I am trying to see how long a record has been in each status.

So we have 5 status
Submit Request 
Assigned 
More Info Needed 
Reaching out to Publishers 
Closed

I want to track how long in minutes this record spent in each status.  I have created fields for all the dates and I have field updates made.  Where I am getting stuck is how do I create a workflow rule that will update "More info needed close date" with "now()" when it leaves a stage.  I know how to create when it goes into the stage but how do I have it update the date field when it leaves a stage.

thanks in advance
Ashish_SFDCAshish_SFDC
Hi Sean, 


This requirement is not possible via Workflow, 

Youhave to write an Apex Class and  Trigger for that. 

The trigger should be fired every time the record is edidted. -> Then, we have to save the edit time and the status code -> Now get the difference and display result. 


Regards,
Ashish
@GM@GM
Write a trigger for this.

In trigger get the created dateTime(for frequent stage you can refer modified date) and now() dateTime and differnce will yields time spen on each stage.

Regards,
GM
pradeep naredlapradeep naredla
hi,
  you can write a formula for this requirment by using ISCHANGE u can achive it.

Regards,
pradeep.