Wednesday, January 22, 2014

What is Scheduler class in Apex

What is Scheduler class in Apex

The Apex class which is programed to run at pre defined 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 implements that interface.
To see what happened to 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);

To see how to make crone job string – refer this URL.

No comments:

Post a Comment