Is there any way, either using apex or the API to unschedule a scheduled job?

  • Are you wanting to upgrade the scheduled class or similar? There's a nice application of Type.forName you can use for decoupling classes if this is the case... Jan 17 '14 at 2:01
  • @user320, your comment intrigues me. Can you answer this question: salesforce.stackexchange.com/questions/24446/… ? Jan 17 '14 at 5:12
  • @DanielHoechst Peter Knolle has got ya covered Jan 17 '14 at 10:28

System.abortJob(Id) can do this. Simply pass in the Id of the CronTrigger for the job in question.

You'll note the docs specifically mention System.schedule results can be passed in, which would represent the scheduled job id; this same value can be obtained from the CronTrigger table.

  • I wasn't sure if abortJob() would take a schedule, thanks for clarifying.
    – greenstork
    Jan 17 '14 at 16:16

You can try something like this :

List<CronTrigger> abort_job = [SELECT Id FROM CronTrigger limit 1];
    for (CronTrigger t : abort_job) { //for each record
     System.abortJob(t.Id); //abort the job


  • 1
    Ha, beat you by 30 seconds! Good answer. Jan 17 '14 at 0:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.