Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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

share|improve this question
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... – bigassforce Jan 17 '14 at 2:01
@user320, your comment intrigues me. Can you answer this question:… ? – Daniel Hoechst Jan 17 '14 at 5:12
@DanielHoechst Peter Knolle has got ya covered – bigassforce Jan 17 '14 at 10:28
up vote 29 down vote accepted

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.

share|improve this answer
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

share|improve this answer
Ha, beat you by 30 seconds! Good answer. – ca_peterson Jan 17 '14 at 0:39

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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