You need to sign in to do that
Don't have an account?
Giorgos Losoff
Only set days counter to count when case is in a certain status
Hi, I am fairly new to Salesforce and this community, so please bare with me. On our case object, we have a field calls "Days Open" that counts when the case is not in the "Closed" status. However, we have added a status called "Pending" and I have run into a bit of a wall. I talked with SF Support and they suggested I turn to this community.
We want the "Days Open" counter to only count when the case is in "Open" status. Then for the counter to stop when it's moved to "Pending" and then start up again if moved back to "Open" and finally when the case is "Closed" to leave the counter in the final number. Meaning if the case is in open for 5 days, the days open counter says 5; then if I move it to pending it stays at 5 and then if I move it back to open for 3 more days, it would say 8. Then when I close the case, the counter still says 8. Any guidance at all would be appreciated and please let me know if I need to clarify anything further!
We want the "Days Open" counter to only count when the case is in "Open" status. Then for the counter to stop when it's moved to "Pending" and then start up again if moved back to "Open" and finally when the case is "Closed" to leave the counter in the final number. Meaning if the case is in open for 5 days, the days open counter says 5; then if I move it to pending it stays at 5 and then if I move it back to open for 3 more days, it would say 8. Then when I close the case, the counter still says 8. Any guidance at all would be appreciated and please let me know if I need to clarify anything further!
You need to schedule it. Use the following Command in the anonymous window under Developer Console
To Stop
If you want to test the job
Once schedule you can see it by going
Right now it is scheduled to run everynight
If you want to change, you can change the following code in the class.
For more details check this link
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_scheduler.htm
I hope this would work as you want. Nothing to change anything on the workflow. Keep the workflow as it is.
All Answers
Use this Formula:
IF( {!IsClosed},null, NOW() - {!CreatedDate} )
This document will help you alot.
http://crmsuccess.blogs.com/files2/100_sample_formulas_v6.pdf
If Yes, don't you think that the value won't persist in that case what Giorgos is asking. I also thought of that but changed my solution to workflow because of that. Please confirm if my undestanding is correct.
I have put in your solution, but it will take a few days to confirm if it is correct. In the mean time, I will keep my eye on this thread in case you have any other suggestions! Thank you!
if all of them doesn't work please send me the screen shots of your configuration. Do it in a word doc.
created and everytime time it's edited
You need to schedule it. Use the following Command in the anonymous window under Developer Console
To Stop
If you want to test the job
Once schedule you can see it by going
Right now it is scheduled to run everynight
If you want to change, you can change the following code in the class.
For more details check this link
https://developer.salesforce.com/docs/atlas.en-us.apexcode.meta/apexcode/apex_scheduler.htm
I hope this would work as you want. Nothing to change anything on the workflow. Keep the workflow as it is.