The Scheduled batch job information internally stored in CornTrigger object in salesforce.
Ex: let as assume you scheduled the batch job using System.schedule(jobName, cronExp, schedulable) method it returns the CornTrigger record Id.
Query the information based on record Id and use the System.abortJob(cornTriggerId); method to abort the scheduled job.
Ex: let as assume you scheduled the batch job using System.schedule(jobName, cronExp, schedulable) method it returns the CornTrigger record Id.
String strCornExp = '0 38 * * * ?';
Id cornId = System.schedule('Test Job', strCornExp, new ScheduleJob());
Query the information based on record Id and use the System.abortJob(cornTriggerId); method to abort the scheduled job.
CronTrigger obj = [SELECT Id, CronJobDetail.Name, CronJobDetail.Id,State FROM CronTrigger where CronJobDetail.Name = 'Test Job'];
System.abortJob(obj.Id);
I would like to thank you for the efforts you have made in writing this article. as we provide Sales Recruitment Agencies at affordable prices. for more info visit our website.
ReplyDeleteI read your post and this blog is very good. You have good knowledge on this. This post really impressed me. Thank you for sharing your knowledge with all of us.
ReplyDeleteSingapore Online Job Vacancy 2021
what if we have more to abort more than 1000 entries
ReplyDelete