DeleteHierarchy operation.

Table of Contents


Purpose: This feature facilitates the deletion of records from the target Salesforce organization, using configurations set in the export.json file.

It considers the relationships between objects to enable a hierarchical or relational context for record deletion.

Feature Description

This functionality is akin to the DeleteSource operation but targets records in the destination organization instead. It operates similarly to the Update operation but performs deletions rather than updates. This feature is particularly useful when you possess a CSV file containing a list of records that need to be removed from the target Salesforce organization. The deletion can be configured for multiple related objects within your export.json.

Example Configuration for DeleteHierarchy

Here is a straightforward example of how to configure the DeleteHierarchy operation within the export.json file, aiming to delete target records by specific record IDs:

"objects": [
        "operation": "DeleteHierarchy",
        "externalId": "Id",
        "query": "SELECT Id FROM Account"

This setup ensures that Accounts, as identified by the IDs in the CSV file, are deleted from the target Salesforce organization.

Executing the Deletion

To execute the deletion operation, the following CLI command should be used:

sfdx sfdmu:run --sourceusername csvfile --targetusername

This command initiates the deletion process where the source of the IDs is a CSV file, and the destination is the specified Salesforce organization.

Last updated on 20th Apr 2024