+ Start a Discussion
Nelum FernandoNelum Fernando 

Workflow rule with time dependent email alert

Hi,

I have set up a workflue rule which sends out an email alert 90 days before the close date of the opportunity, if the opportunity stage is equal to renewal. It is working fine on the new opportunities I created to test. However I created a "renewal" oportunity today with a close date in August'16. So the 90 days is already lapsed, but it still triggered an email. Have I missed something in my logic and how can I fix it ?  

 
Best Answer chosen by Nelum Fernando
Anupam Bansal (Capgemini)Anupam Bansal (Capgemini)
Hi Nelum

If your time dependent workflow rules meet the criteria which you have put in and the time has elapsed, salesforce will still execute the workflow rules.

Following text explains it : 

"If you change a date field that is referenced by an unfired time trigger in a workflow rule that has been evaluated, Salesforce recalculates the unfired time triggers associated with the rule. For example, if a workflow rule is scheduled to alert the opportunity owner 7 days before the opportunity close date and the close date is set to 2/20/2011, Salesforce sends the alert on 2/13/2011. If the close date is updated to 2/10/2011 and the time trigger hasn't fired, Salesforce reschedules the alert for 2/3/2011. If Salesforce recalculates the time triggers to a date in the past, Salesforce triggers the associated actions shortly after you save the record.

If a workflow rule has a time trigger set for a time in the past, Salesforce queues the associated time-dependent actions to start executing within one hour. For example, if a workflow rule on opportunities is configured to update a field 7 days before the close date, and you create an opportunity record with the close date set to today, Salesforce starts to process the field update within an hour after you create the opportunity.
"
Reference : https://help.salesforce.com/HTViewHelpDoc?id=workflow_time_action_considerations.htm&language=en_US

If you dont want to execute the workflows maybe you can add a simple condition - Close Date - Created Date > 90 so that it does not enter your workflow rules at all for your case.

Thanks,
Anupam Bansal 

All Answers

Anupam Bansal (Capgemini)Anupam Bansal (Capgemini)
Hi Nelum

If your time dependent workflow rules meet the criteria which you have put in and the time has elapsed, salesforce will still execute the workflow rules.

Following text explains it : 

"If you change a date field that is referenced by an unfired time trigger in a workflow rule that has been evaluated, Salesforce recalculates the unfired time triggers associated with the rule. For example, if a workflow rule is scheduled to alert the opportunity owner 7 days before the opportunity close date and the close date is set to 2/20/2011, Salesforce sends the alert on 2/13/2011. If the close date is updated to 2/10/2011 and the time trigger hasn't fired, Salesforce reschedules the alert for 2/3/2011. If Salesforce recalculates the time triggers to a date in the past, Salesforce triggers the associated actions shortly after you save the record.

If a workflow rule has a time trigger set for a time in the past, Salesforce queues the associated time-dependent actions to start executing within one hour. For example, if a workflow rule on opportunities is configured to update a field 7 days before the close date, and you create an opportunity record with the close date set to today, Salesforce starts to process the field update within an hour after you create the opportunity.
"
Reference : https://help.salesforce.com/HTViewHelpDoc?id=workflow_time_action_considerations.htm&language=en_US

If you dont want to execute the workflows maybe you can add a simple condition - Close Date - Created Date > 90 so that it does not enter your workflow rules at all for your case.

Thanks,
Anupam Bansal 
This was selected as the best answer
Nelum FernandoNelum Fernando
Hi Anupam,

Thanks a lot for informative answer. If you can help me furhter,  I was not successful in creating the date condition as I cannot figure out how to substract dates in the criteria. Any advice ? 
Anupam Bansal (Capgemini)Anupam Bansal (Capgemini)

Hi Nelum,

You have to change your Workflow rule to use  ->  Run this rule if the following "formula evaluates to true" and over ther put in all your conditions in the formula builder

Thanks,
Anupam
 

Nelum FernandoNelum Fernando
Thta's where I'm trying to put the condition. My porblem is that it doesn't allow to substract date values 
Nelum FernandoNelum Fernando
I figured it out. Thanks a lot for yor help.
Anupam Bansal (Capgemini)Anupam Bansal (Capgemini)
Cool. You just have to use DATETIMEVALUE(CloseDate) - DATETIMEVALUE(CreatedDate) > 90 as one of your condition

Thanks,
Anupam