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]) {
<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>


Job Status from Apex Job Queue Object:

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 –

Written by 

2x Salesforce MVP | Platform Champion | 18x Salesforce Certified | MuleSoft Certified | 8x Trailhead Ranger | TechForce Services | Sydney | Australia

Leave a Reply

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