Tuesday, 14 February 2017

How to delete all scheduler jobs at a time?

Hi All,

Below is the script to help you to delete all scheduler jobs at a time.

List<CronTrigger> scope = [select id from CronTrigger];
System.debug('Hi---'+scope );
for(CronTrigger cron:scope ){
System.abortJob(cron.id);

}

Thanks,
Asish

2 comments:

Job said...

Anyways why do you need to delete those Jobs?

Asish Kumar Behera said...

Lets take an example, when a sandbox is refreshed we need to stop all scheduling jobs so that we can mask all production email.