Loading

Abort Bulk API jobs

Publiceringsdatum: Dec 18, 2023
Beskrivning
Sometimes, multiple BULK API jobs are scheduled in an org and they need to be aborted. However, doing this manually is a tedious task. Thus, the given solution can be used as an alternate method.
 

NOTE: This help is provided as a part of cookbook. This code is not supported to by Salesforce. It is to be used after understanding the risks involved.

Lösning

Documentation for BULK API is available which can be checked for all details about calls.

  • When you submit a bulk API job in Salesforce, a response is sent by Salesforce which contains the Job ID that is created. This job ID is to be stored by the end-client that submits the job. 
  • You can get the list from the browser as well. There is no way to query the list of BULK API jobs. An idea already exists for the same. Please feel free to vote for it.
  • You have the option to make REST calls to abort the job. The documentation contains the details of the abort calls.
The Java code attached will cause the Job to be aborted using REST calls as explained in the doc.

Info to collect before running Java code

  • Prepare a CSV file which would contain the list of all Jobs as the first column. We recommend that you don't add any other information to the CSV.
  • Get an active Session ID of a user who has permission to make the API calls in org and abort the jobs.
  • Get the Org's Base URL.

Process to use the Java file

1. Put the csv file in the folder of PATH.
2. Update the Java code with Session ID.
3. Update the Org's base URL in the Java code.

What does the Java file do?

  • It reads the job IDs from a CSV file.
  • Makes an abort call to Salesforce.

Once everything is ready, run the file.

Additional Reference:
Close or Abort a Job
Knowledge-artikelnummer

000382516

Bilagor

JAVA_Code_to_abort_job.txt

2 KB

 
Laddar
Salesforce Help | Article