You need to sign in to do that
Don't have an account?
Aaditya Singh
How to create a trigger to calculate the number of days a field was in stop status
Create a new object Survey Request with below fields,
- Status – Pick list(Options: Open, Close , Start, Stop)
- Stop Started date – date
- Total Stop Duration in days-- Integer
- Create a trigger on survey request to capture the total days for which the survey request was stopped and store the same in Total Stop Duration in day’s field.
Greetings to you!
You don't need a trigger for that, you can do it through workflow rules.
To calculate the duration of how long a field stays in a particular Picklist Value, please refer to the below knowledge article.
https://help.salesforce.com/articleView?id=000213870&type=1
Also, please refer to below links which might help you further.
https://developer.salesforce.com/forums/?id=906F00000008pC4IAI
https://salesforce.stackexchange.com/questions/106356/how-to-calculate-the-age-of-the-stage-field-when-it-changes-from-one-stage-to-an
I hope it helps you.
Kindly let me know if it helps you and close your query by marking it as solved so that it can help others in the future. It will help to keep this community clean.
Thanks and Regards,
Khan Anas
I really appriciate your help regarding above issue but i have got an assignment in which i need to create a trigger for the same.
I have already gone through this article and this is very helpful but currently I am looking for Trigger solution.
You can enable field History traking on status field.
It might help you.