function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
santhosh konathala 8santhosh konathala 8 

Can anybody send how to suspend a batch job?

JethaJetha
String SCHEDULE_NAME = 'test'; 
id cronid = System.schedule(SCHEDULE_NAME, '0 15 0-23 * * ?', new scheduledMaintenance()); 
System.abortJob(cronid);

I mean, you can intentionally schedule your job to get jobId and then Abort you job.
Amit Chaudhary 8Amit Chaudhary 8
Please try below code to abord any job in salesforce
for(CronTrigger ct : [SELECT Id, CronJobDetail.Name, CronJobDetail.JobType
                        FROM CronTrigger
                       WHERE CronJobDetail.Name like 'Work Order%']){
 
    // abort the job, try/catch because the job might not exist
    // if it's being aborted manually or from another execution
    try{
        system.abortJob(ct.id);
    } catch (exception e) {}
}
http://blog.crmscience.com/2015/06/how-to-abort-scheduled-queued-apex-job.html

https://www.interactiveties.com/blog/2012/batch-apex-test.php

http://support.beaufort12.com/customer/portal/articles/1759433-how-do-i-stop-scheduled-jobs-

Let us know if this will help you

Thanks
Amit Chaudhary
nitesh gadkarinitesh gadkari
Hi Santosh,

You can go to Setup pages> Monitor>Jobs>Apex jobs

From Here you will get the jobid which you can use to excute system.abortJob(jobid) in Enonymous window in Developer console.

Regards
Nitesh