Last active
December 26, 2015 03:09
-
-
Save cdeckert/7083499 to your computer and use it in GitHub Desktop.
Stop all scheduled jobs in Salesforce
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
List<CronTrigger> listCronTrigger = [SELECT Id, CronExpression, EndTime, NextFireTime, OwnerId, | |
PreviousFireTime, StartTime, State, TimesTriggered, TimeZoneSidKey FROM CronTrigger | |
WHERE State != 'DELETED']; | |
System.debug('#### Number of jobs: '+listCronTrigger.size()); | |
if (listCronTrigger.size() > 0) | |
{ | |
for (CronTrigger aCronTrigger : listCronTrigger) | |
{ | |
System.abortJob(aCronTrigger.Id); | |
System.debug('#### deleted Job details :' + String.valueOf(aCronTrigger)); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment