Schedule Batch Class To Run Hourly On Every 15th Minutes In Salesforce

You can use the System.schedule method, which takes a cron string to represent the repeating time.

Execute below code to run batch on every 15th minutes of hours.

String CRON_EXP = ‘0 15 * * * ?’;
testSchedule sch = new testSchedule();
system.schedule(‘Test Schedule’, CRON_EXP, sch);

Changes 15 to schedule as your requirement!

For Hourly on 0 minute use below code:

String CRON_EXP = ‘0 0 * * * ?’;
testSchedule sch = new testSchedule();
system.schedule(‘Test Schedule’, CRON_EXP, sch);

Leave a Reply

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