top of page

Use Apex Scheduler for regular maintenance tasks

To invoke Apex classes to run at specific times, first implement the Schedulable interface for the class.

Then, schedule an instance of the class to run at a specific time using the System.schedule method.

Implement the execute method of this interface.


use the System.Schedule method to execute it.

The System.Schedule method takes three arguments:

  • a name for the job,

  • a CRON expression used to represent the time and date the job is scheduled to run,

  • and the name of the class.

eg:

<Schedule Apex class name> reminder = new <Schedule Apex class name>();

// Seconds Minutes Hours Day_of_month Month Day_of_week optional_year

String sch = '20 30 8 10 2 ?';

String jobID = System.schedule('Remind Opp Owners', sch, reminder);

Recent Posts

See All

Comments


Post: Blog2_Post

©2020 by SalesforceDemystified. Proudly created with Wix.com

bottom of page