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?

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

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
    } catch (exception e) {}

Let us know if this will help you

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.