How to Perpetually Send Emails In Salesforce

Time-Based Workflow Rule Limitations

circle2Out-of-box workflow rules come up short if you want to perpetually send emails in Salesforce. A workflow rule can only have up to 10 time triggers. To continually send emails on a daily, weekly, monthly, or quarterly cadence you could leverage batch Apex to send email messages. However, if you have a quick requirement to fulfill you may consider using workflow rules in a creative way to send these emails. To best highlight how to leverage workflow rules I will provide a sample requirement and how two workflow rules were leverage to meet it.

Requirement & Solution

Requirement: A client providing bankruptcy filing services wants to continually remind their clients via email to pay their trustee/creditor on a monthly basis. The email should include the amount due and address of where to send the payment. Emails should stop being sent on and after the date the case is dismissed.

Solution: Create a date field on the Case object that represents when you want the emails to stop. In this example we will call this the Case Dismissed Date. Create a text field on the Case object called Stop Sending Trustee Reminder Email and set the default value to “no”.

Create Workflow Rule 1: 

Evaluation Criteria: Evaluate when the record is created, and any time it’s edited to subsequently meet the criteria.

Rule Criteria:

AND(
    OR(
       ISBLANK(Case_Dismissed_Date__c),
       TODAY() < Case_Dismissed_Date__c
      ),
Stop_Sending_Trustee_Email__c = "no"
)

Workflow Actions – Immediate Actions:

Email Alert: Send Trustee Payment Reminder Email

Field Update: Update Stop_Sending_Trustee Email__c to “yes”

Create Workflow Rule 2: 

Evaluation Criteria: Evaluate when the record is created, and any time it’s edited to subsequently meet the criteria.

Rule Criteria:

AND(
    OR(
       ISBLANK(Case_Dismissed_Date__c),
       TODAY() < Case_Dismissed_Date__c
      ),
Stop_Sending_Trustee_Email__c = "yes"
)

Workflow Actions – Time Dependent Actions:

30 Days after Rule Trigger Date:

Field Update: Update Stop_Sending_Trustee Email__c to “yes”

This field update subsequently triggers Workflow Rule 1 above and sends an email out immediately (after 30 days).

Conclusion

istock_000015396036small-460x280By leveraging two workflow rules we are able to “teeter-totter” the email reminders back and forth perpetually. We are able to circumvent the limit of 10 time triggers, and don’t have to worry about a user updating a record to trigger any emails. One workflow edits the record to match the criteria in the other, and so on.

Leave a Reply

Your email address will not be published. Required fields are marked *