How to abort Apex Jobs using Apex in Salesforce?

How to abort Apex Jobs using Apex in Salesforce?

Use System.abortJob( ‘<JobID>’ )

 to abort the apex job in Salesforce.

To get the JobId, use the “AsyncApexJob” object. Add proper WHERE condition to the SOQL to find the Job Ids.

SELECT Id, Status
FROM
AsyncApexJob
WHERE CreatedDate = TODAY

Help Article – https://help.salesforce.com/articleView?id=000324656&type=1&mode=1

Leave a Reply