Print this page

Unable to schedule jobs due to an orphaned cron trigger

Knowledge Article Number 000193672
Description You might encounter an error when trying to schedule a job due to an orphaned cron trigger.
Resolution
Run the following code in execute anonymous window in developer console or in Workbench -> Utilities -> Apex execute in order to delete the orphaned cron trigger records.

###############
integer i = 1; 
integer thisDmlLimit = limits.getLimitDMLRows(); 
for (CronTrigger ct : [select id from crontrigger where state = 'Deleted']){ 
if (i == thisDmlLimit){ 
system.debug('===========> Run this script again'); 
break; 
system.abortJob(ct.id); 
i++; 
}
###############

If this doesn't work, please reach out to salesforce support and a T3 support engineer can run the script to resolve the issue.




promote demote