長時間実行中の batch, future, または scheduled された Apex ジョブを中止するには、System.abortJob()を使用します。batch および future Apex ジョブの場合、このメソッドにジョブに関連付けられた AsyncApexJob ID を渡します。scheduled された Apex ジョブの場合、このメソッドにジョブに関連付けられた CronTrigger ID を渡します。
非同期 Apex ジョブを匿名 Apex ブロックで中止する
'YourAsyncApexClassName' を非同期 Apex クラスの名前に置き換えて以下コードを実行してください。SOQL クエリは 200 件のジョブに制限されますので、200 件を超えるジョブを中止する場合は再実行してください。
List<AsyncApexJob> jobsToAbort = [SELECT Id, CronTriggerId, JobType from AsyncApexJob
WHERE ApexClass.Name = 'YourAsyncApexClassName' AND Status = 'Queued' LIMIT 200];
for (AsyncApexJob jobToAbort : jobsToAbort) {
if (jobToAbort.JobType == 'ScheduledApex') {
System.abortJob(jobToAbort.CronTriggerId);
} else {
System.abortJob(jobToAbort.Id);
}
}
Salesforce ユーザーインターフェースから非同期 Apex ジョブを中止する
000385103

We use three kinds of cookies on our websites: required, functional, and advertising. You can choose whether functional and advertising cookies apply. Click on the different cookie categories to find out more about each category and to change the default settings.
Privacy Statement
Required cookies are necessary for basic website functionality. Some examples include: session cookies needed to transmit the website, authentication cookies, and security cookies.
Functional cookies enhance functions, performance, and services on the website. Some examples include: cookies used to analyze site traffic, cookies used for market research, and cookies used to display advertising that is not directed to a particular individual.
Advertising cookies track activity across websites in order to understand a viewer’s interests, and direct them specific marketing. Some examples include: cookies used for remarketing, or interest-based advertising.