2

I have time dependent workflow email alerts on a custom object which send outs an email alert to user 60,30,15 days before expiry date.But when a new record is created on a custom object with 16 days before expiry date it still sends out 3 email alerts where it should only send 1 email alert to user.

what could be the reason for 3 emails ? Is there a way we could stop sending out 3 emails and just send 1 email to user.

Evaluation Criteria:

Evaluate the rule when a record is created, and any time it's edited to subsequently meet criteria.

Rule Criteria :

IF(User <> NULL && Expiry_Alert__c = true,true,false)

User Requirement :

Need 3 alerts for 60,30,15days before expiry date if record created date is more than 60 days. 2 alerts for 30,15 days before expiry date if record created date is more than 30days and less than 60days before expiry date and 1 alert if record created date is more than 15 days and less than 30 days before expiry date.

  • what is the condition of sending email alerts? Workflow rule criteria? – Santanu Boral Apr 5 '17 at 19:43
  • @SantanuBoral Updated the question – sfdc Apr 5 '17 at 19:46
2

As @sebmaldo stated in his answer - all time-dependent actions with a date in the past start executing right away. To avoid this, you have to include date validation in your criteria, and this will mean that you have to split your single workflow rule into 3 - one for each time-dependent action.

Next, your current validation formula isn't perfect, can be rewritten to: ISBLANK(User) && Expiry_Alert__c

  • What record created date is from user requirements? Why do you not reference it in your WR validation?
  • Is Expiry_Alert__c a flag or a formula?

The best formula would be ISBLANK(User) && ((Expiration_Date__c - TODAY()) >= 15) for 15 days alert and also create 2 more WR for 30 and 60 days.

4

I think this work this way because of the queue system, it run all the "outdated" action to be executed in the next hour it is inserted, if you see the considerations for this kind of process, it explicitly indicates this behavior.

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.

  • We can delete the actions manually by going to Monitoring ->Time based Workflow --> Delete the action . Is there a way to auto remove actions from the time based workflow queue if the scheduled date is past ? – sfdc Apr 5 '17 at 20:20
  • I don't know, we resolve a similar issue executing an Apex class with the logic to send the mail, we use it to have more flexibility in the verification of the email send. – sebmaldo Apr 5 '17 at 20:29

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.