function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
sundhar.mks1.3962649227519546E12sundhar.mks1.3962649227519546E12 

Sheduler class

Hi,

How to run the sheduler class to execute anonymous?


Thank's.....
Best Answer chosen by sundhar.mks1.3962649227519546E12
nitesh gadkarinitesh gadkari
//create instance of the schedular class 
SchedularClassName itsInstance=new SchedularClassName();
  
 //str (SchedularClassName.str) is the cron_expression
    
     string jobid=system.schedule('some_name_of_job', SchedularClassName.str, itsInstance);
 
    system.debug(jobid);

 //you will get joibid in debug log .copy that and pass in below function. if you want to abort the job 
 
system.abortJob('08ei000000dsOnf');
May this help you.

Regards 
Nitesh Gadkari

All Answers

nitesh gadkarinitesh gadkari
//create instance of the schedular class 
SchedularClassName itsInstance=new SchedularClassName();
  
 //str (SchedularClassName.str) is the cron_expression
    
     string jobid=system.schedule('some_name_of_job', SchedularClassName.str, itsInstance);
 
    system.debug(jobid);

 //you will get joibid in debug log .copy that and pass in below function. if you want to abort the job 
 
system.abortJob('08ei000000dsOnf');
May this help you.

Regards 
Nitesh Gadkari
This was selected as the best answer
sundhar.mks1.3962649227519546E12sundhar.mks1.3962649227519546E12
Hi Nitesh Gadkari, Thank's for your information Regards Sundhar M