DeleteHierarchy operation.
This feature allows you to delete object's records from the Target org, which are a final result of selection based on the whole export.json configuration, considering the relationships between objects.
Feature overview.
It's similar to the DeleteSource operation but it deletes Target records.
It acts lust like the Update operation, but makes a deletion instead of update.
This feature is useful when if, for instance, you have a source csv file contains list of record Ids to be deleted from the target salesforce org.
You can add to you export.json as many related objects to delete as you want.
Example of DeleteHierarchy configuration.
"objects": [
{
"operation": "DeleteHierarchy",
"externalId": "Id",
"query": "SELECT Id FROM Account"
}
],
This configurations deletes Accounts from the target org, using records in the CSV file as a data source.
Execute the job with the following CLI command:
sfdx sfdmu:run --sourceusername csvfile --targetusername test@testorg.com