Our Blog

Schedule Job: How to Delete it using Apex in Salesforce?

Schedule Job: How to Delete it using Apex in Salesforce?

I am going to show you, how you can remove or delete the Schedule Job in Apex.

First of all, you need to know that Schedule Job is not deleted, it’s aborted.

You need to retrieve the id of the Schedule Jobs by querying the “Cron Trigger” object using the following query:

 

[SELECT ID FROM CRONTRIGGER];

Then you need to abort each job using System.abortJob(<jobId>); function.

Below is your final script should look like:

 

List<CronTrigger> JOBIDLIST = new List<CronTrigger>();
JOBIDLIST = [select id from CronTrigger];
for(CronTrigger job:JOBIDLIST )
{
   System.abortJob(job.id);
}

So using the above script you can abort the scheduled job in Salesforce using Apex.

Looking for integration between Salesforce and Quickbooks Online?

Salesforce AppExchange: eShopSync for Quickbooks Online

Details: QuickBooks Salesforce Connector

Leave a Comment

Comments (0)

Please verify that you are not a robot.

Welcome back

Welcome back! Please enter your details

One or more fields have an error. Please check and try again.

Forgot Password?

Tell us about Your Company

How can we help you with your business?