How to Stop Apex Scheduled jobs in Salesforce

System.abortJob(Id) can do this. Simply pass in the Id of the AsyncApexJob 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 AsyncApexJob table.

Its possible using the below piece of code:
Run the following piece of code in your salesforce org developer console to deactivate any active jobs
-> Go to developer console> Debug (from top menu)> Open Execute Anonymous Window.

Paste below code and hit Execute from Developer Console:

<div class="post-text">
<pre><code>for (CronTrigger ct : [SELECT Id FROM CronTrigger]) {
    System.abortJob(ct.Id);
}
</code></pre>
</div>
<div class="grid mb0 fw-wrap ai-start jc-end gs8 gsy"><time datetime="2014-01-30T15:02:47"></time>
<div class="grid--cell mr16"></div>
</div>

 

Job Status from Apex Job Queue Object:

STATUS DESCRIPTION
Queued Job is awaiting execution.
Preparing The start method of the job has been invoked. This status might last a few minutes depending on the size of the batch of records.
Processing Job is being processed.
Aborted Job was aborted by a user.
Completed Job completed with or without failures.
Failed Job experienced a system failure.

Monitoring the Apex Job Queue – https://dreamevent.secure.force.com/articleView?id=code_apex_job.htm&type=0

Written by 

Salesforce MVP | Lightning Champion | 17x Salesforce Certified | Application Architect | 7x Trailhead Ranger | Techforce Services | Australia

Leave a Reply

Your email address will not be published. Required fields are marked *

*