function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Venkatesh MandlemVenkatesh Mandlem 

Batch script to schedule daily batch job for reminder emails

How To schedule a daily batch job which runs daily and sends out reminder mails 24 hours before .
NagaNaga (Salesforce Developers) 
Hi Venkatesh,

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.

Please let me know if this helps

Best Regards
Naga kiran
NagaNaga (Salesforce Developers) 
Hi Venkatesh,

You can also try the code below which is quite similar

User-added image

Please let me know if this helps

Best Regards
Naga kiran