Activity Forums Salesforce® Discussions How to schedule a class in Apex?

  • Manpreet

    Member
    April 24, 2017 at 1:08 pm

    Hi Suraj,

    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 the user has permission to execute the class or not. For more information on setting class permissions, see “Apex Class Security Overview” in the Salesforce online help.
    To monitor or stop the execution of a scheduled Apex job using the Salesforce user interface, go to Setup --> Monitoring --> Scheduled Jobs. For more information, see “Monitoring Scheduled Jobs” in the Salesforce online help.
    The Schedulable interface contains one method that must be implemented, execute.
    global void execute(SchedulableContext sc){}
    Example:
    global class scheduledAccountUpdate implements Schedulable {
    global void execute(SchedulableContext SC) {
    AccountUpdate acc = new AccountUpdate('Description','Updated Account');
    }
    }

    Thanks.

Log In to reply.

Popular Salesforce Blogs

Popular Salesforce Videos