force data bulk delete
Bulk delete records from an org using a CSV file. Uses Bulk API 1.0.
The CSV file must have only one column (“Id”) and then the list of record IDs you want to delete, one ID per line.
When you execute this command, it starts a job and one or more batches, displays their IDs, and then immediately returns control of the terminal to you by default. If you prefer to wait, set the –wait flag to the number of minutes; if it times out, the command outputs the IDs. Use the job and batch IDs to check the status of the job with the “sf force data bulk status” command. A single job can contain many batches, depending on the length of the CSV file.
| Flag Name (Long) | Flag Name (Short) | Description |
|---|---|---|
‑‑api‑version | N/A | Type: Value Override the api version used for api requests made by this command |
‑‑file | ‑f | Type: Value Required CSV file that contains the IDs of the records to delete. |
‑‑flags‑dir | N/A | Type: Value Import flag values from a directory. |
‑‑json | N/A | Type: Boolean Format output as json. |
‑‑sobject | ‑s | Type: Value Required API name of the Salesforce object, either standard or custom, that you want to delete records from. |
‑‑target‑org | ‑o | Type: Value Required Username or alias of the target org. Not required if the target-org configuration variable is already set. |
‑‑wait | ‑w | Type: Value Number of minutes to wait for the command to complete before displaying the results. |
Bulk delete Account records from your default org using the list of IDs in the “files/delete.csv” file:
Bulk delete records from a custom object in an org with alias my-scratch and wait 5 minutes for the command to complete: