I'm trying to make a field that counts the amount of days another field has been sitting without it being changed. The ultimate goal is to set up auto emails that trigger when a field has been sitting without being changed for more than 4 days. If possible can someone walk me in the right direction on how to create this.
1 Answer
I would solve it with a date field (to record the last changed date), a number formula field (to calculate the number of days since the change), and a workflow rule to set the date. For example, to monitor the opportunity stage field, you might do the following:
Field To Monitor: StageName
Date Field: Stage_Last_Changed_Date__c
Number Formula Field: Days_Since_Stage_Changed__c
TODAY() - BLANKVALUE(Stage_Last_Changed_Date__c, CreatedDate)
Workflow Rule:
ISCHANGED(StageName) ||
(
ISNEW() &&
NOT(ISBLANK(StageName))
)
Workflow Field Update: Stage_Last_Changed_Date__c =
TODAY()
Technically the StageName field doesn't need the "NOT(ISBLANK(StageName))" piece, because it's a required field, and will never be blank. But other fields may require it.