Activity Forums Salesforce® Discussions What is Scheduler class in Salesforce Apex and explain how to use Cron statement to Schedule Apex class?

  • shariq

    Member
    September 22, 2018 at 10:33 pm

    The Apex class which is programmed to run at a predefined interval.

    Class must implement schedulable interface and it contains method named execute().

    There are two ways to invoke schedular:

    Using UI
    Using System.schedule

    The class which implements interface schedulable get the button texted with “Schedule”, when user clicks on that button, new interface opens to schedule the classes which implement that interface.
    To see what happened to the scheduled job, go to “Monitoring | Scheduled jobs ”

    Example of scheduling:

    scheduledMerge m = new scheduledMerge();
    String sch = '20 30 8 10 2 ?';
    system.schedule('Merge Job', sch, m);

  • Parul

    Member
    September 23, 2018 at 3:43 am

    Implementing the Schedulable Interface. To schedule an Apex class to run at regular intervals, first write an Apex class that implements the Salesforce-provided interface Schedulable . The scheduler runs as system—all classes are executed, whether or not the user has permission to execute the class.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos