Find your content:

Search form

You are here

Best approach for sending daily email reminders

 
Share

I use scheduler + batch apex + Messaging.SingleEmailMessage to send out reminder emails every 2 weeks to a specific set of users in a public group!!!

Is this a decent approach/ is there any other alternative approach that I can do using time based workflow which I can take?


Attribution to: Rao

Possible Suggestion/Solution #1

Since you require a proactive scan, Scheduled Apex would be the recommended approach.

You could have a hidden Date field on Account called FieldsLastUpdated__c

Have a workflow that fires each time the record is created or edited, check if the fields you're interested in are updated (using ISCHANGED()) and if they have been updated, set this date to TODAY()

This now signifies that those fields were updated on the Date stamped in the FieldsLastUpdated_c

Have a simple batch class that runs each night, and scans for Account records where FieldsLastUpdated__c < Date.today().addDays(-14) i.e. 2 weeks using the QueryLocator

Now in your execute cycle through these Account and for each create an email for the owner, and the finally bulk send.


Attribution to: techtrekker
This content is remixed from stackoverflow or stackexchange. Please visit https://salesforce.stackexchange.com/questions/4077

My Block Status

My Block Content