Activity Forums Salesforce® Discussions How can I schedule an Apex class in Salesforce?

  • Udit

    Member
    February 6, 2020 at 3:45 pm

    Hello Kirandeep,

    We can do this by creating an apex schedule class first as following:

    // Apex Schedule Class
    global class ScheduleBatchApex implements Schedulable {
    global void execute(SchedulableContext sc) {
    className b = new className();
    database.executebatch(className);
    }
    }

    After this follow the below steps to schedule apex class:

    1. Search apex classes in setup
    2. After selecting apex classes, click schedule apex button.
    3. Select label of schedulable class and select schedule class which you have created from lookup.
    4. Define frequency and time on which you want your class to be scheduled.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos