System.AsyncException: The Apex job named is already scheduled for execution.
System.AsyncException: The Apex job named is already scheduled for execution.
Hi All,
When i was trying to schedule my class for every 15 miuntes to run. I was getting below error.
System.AsyncException: The Apex job named "Global App Logs Purge" is already scheduled for execution.
e.g.
Schedular_GlobalAppLogPurgeBatch globalPurgeBatchSchedular = new Schedular_GlobalAppLogPurgeBatch();
System.schedule('Global App Logs Purge', '0 0 * * * ? *', globalPurgeBatchSchedular);
System.schedule('Global App Logs Purge', '0 15 * * * ? *', globalPurgeBatchSchedular);
System.schedule('Global App Logs Purge', '0 30 * * * ? *', globalPurgeBatchSchedular);
System.schedule('Global App Logs Purge', '0 45 * * * ? *', globalPurgeBatchSchedular);
When i change the all the 4 job name from "Global App Logs Purge" to "Global App Logs Purge1","Global App Logs Purge2","Global App Logs Purge3","Global App Logs Purge4". I did not get any error. So the conclusion is every Job should be unique.
Corrected Code:
Schedular_GlobalAppLogPurgeBatch globalPurgeBatchSchedular = new Schedular_GlobalAppLogPurgeBatch();
System.schedule('Global App Logs Purge1', '0 0 * * * ? *', globalPurgeBatchSchedular);
System.schedule('Global App Logs Purge2', '0 15 * * * ? *', globalPurgeBatchSchedular);
System.schedule('Global App Logs Purge3', '0 30 * * * ? *', globalPurgeBatchSchedular);
System.schedule('Global App Logs Purge4', '0 45 * * * ? *', globalPurgeBatchSchedular);
I hope this will help you.
When i was trying to schedule my class for every 15 miuntes to run. I was getting below error.
System.AsyncException: The Apex job named "Global App Logs Purge" is already scheduled for execution.
e.g.
Schedular_GlobalAppLogPurgeBatch globalPurgeBatchSchedular = new Schedular_GlobalAppLogPurgeBatch();
System.schedule('Global App Logs Purge', '0 0 * * * ? *', globalPurgeBatchSchedular);
System.schedule('Global App Logs Purge', '0 15 * * * ? *', globalPurgeBatchSchedular);
System.schedule('Global App Logs Purge', '0 30 * * * ? *', globalPurgeBatchSchedular);
System.schedule('Global App Logs Purge', '0 45 * * * ? *', globalPurgeBatchSchedular);
When i change the all the 4 job name from "Global App Logs Purge" to "Global App Logs Purge1","Global App Logs Purge2","Global App Logs Purge3","Global App Logs Purge4". I did not get any error. So the conclusion is every Job should be unique.
Corrected Code:
Schedular_GlobalAppLogPurgeBatch globalPurgeBatchSchedular = new Schedular_GlobalAppLogPurgeBatch();
System.schedule('Global App Logs Purge1', '0 0 * * * ? *', globalPurgeBatchSchedular);
System.schedule('Global App Logs Purge2', '0 15 * * * ? *', globalPurgeBatchSchedular);
System.schedule('Global App Logs Purge3', '0 30 * * * ? *', globalPurgeBatchSchedular);
System.schedule('Global App Logs Purge4', '0 45 * * * ? *', globalPurgeBatchSchedular);
I hope this will help you.
Comments
Post a Comment