In Approval Process Reminders we have provided buttons to automatically schedule the emails every day at midnight or to run the reminder email ad-hoc. But what if you want to do it at a different time, or only on weekdays? You can do that by scheduling the job in the Developer Console.
Pre-requisites: Approval Process Reminders is installed and you have System Administrator permissions.
Determining the Schedule
This part requires that you create a cron expression that will create the schedule that you'd like. You can read about the Salesforce scheduler and how to create a cron expression in the Salesforce Help on Apex Scheduler.
Note: the time zone will be based on the person that scheduled the job.
Here are a couple of example expressions:
Expression | Schedule |
0 0 8 * * ? | Every day at 8 am |
0 0 22 ? * 6L | Last Friday of every month at 10 pm |
0 0 10 ? * MON-FRI | Every weekday at 10 am |
Scheduling the Job
First, go to the Approval Process Reminders tab and deschedule the job if you already scheduled the job every night at midnight.
In Salesforce, click the gear in the top right and go to Developer Console.
Click on Debug then Open Execute Anonymous Window.
Enter the following code. Replace the text in the quotes on line two with your customized cron schedule.
ApprovalRemind.ApprovalProcessReminder m = new ApprovalRemind.ApprovalProcessReminder();
String sch = '0 0 0 * * ?';
String jobID = system.schedule('Approval Process Reminder Job', sch, m);