How to make a batch class schedulable

| By Ayush Sharma

Batch Apex is a very powerful tool that allows us to work on large volumes of data in bite-sized chunks (batches) so that we don’t hit Salesforce’s governor limits. Often, we need to schedule our batch apex to run at a specified time, and at that time we need Scheduled Apex as well.

What if we could put all under one apex so we can have an easily started batch job that’s easy to schedule?
All we need to do is to implement Schedulable Class and then add its mandate method “execute(SchedulableContext SC)” which will contain code to execute the batch file. Refer to Screenshots 1 and 2.


Once done with it then to schedule the batch at desired time and day follow the steps below:

  1. Open Setup and Search Apex Classes.
  2. Inside Apex classes open Schedule Apex.
  3. Then Give desired job Name and select the apex class.
  4. Then select Schedule frequency as weekly or monthly and also its start date and end date.
  5. Set preferred start time and save the job.

This will create the scheduled job that will run our batch class at our scheduled time. Refer to screenshot 3.

Leave a Reply

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