Get started with the SFDMU.


The SFDX Data Move Utility (SFDMU) will populate your org with quality record data just in three simple steps.


Table of Contents



Step 1. Install the SFDMU.

Before installing and using this Plugin make sure you've already have the SFDX CLI platform installed on your system.

Please, see this article how to install the SFDX CLI.

Then perform the following commands in the Terminal/Console:

# If you have an old version of the Plugin, uninstall it:
$ sf plugins uninstall sfdmu

# Install the latest version of the Plugin:
$ sf plugins install sfdmu

Step 2. Configure the migration job.

Example of basic configuration: upserting Accounts.

Create a new export.json file with the following format:

{
    "objects": [
        {
            "query": "SELECT Id, Name FROM Account",
            "operation": "Upsert",
            "externalId": "Name"
        }
    ]
}

Example of advanced configuration: upserting multiple related SObjects.

Assume you have the following data model with complex circular relationships between SObjects:

diagram

Let's say, each record has unique Name value, so you want to use Name field as an External ID field for all SObjects in that data model.

You can Upsert all records preserving relationships between SObjects by creating an export.json file with the following format:

{
    "objects": [
        {
            "query": "SELECT Id, Phone, TestObject3__c FROM Account WHERE Name LIKE 'TEST_ACC_%'",
            "operation": "Upsert",
            "externalId": "Name"
        },
        {
            "query": "SELECT Id, Account__c, TestObject3__c, RecordTypeId FROM TestObject__c",
            "operation": "Upsert",
            "externalId": "Name"
        },
        {
            "query": "SELECT Id, Account__c, TestObject__c FROM TestObject2__c",
            "operation": "Upsert",
            "externalId": "Name"
        },
        {
            "query": "SELECT Id, TestObject2__c FROM TestObject3__c",
            "operation": "Upsert",
            "externalId": "Name"
        }
    ]
}
Notes:
  • Object API names in export.json query expressions are case-sensitive, make sure they are spelled correctly if you want them to be imported.

Step 3. Run the migration job.

  • Go to the directory where your export.json is located.

  • Use the following command to run a direct migration between source and target salesforce orgs:

$ sf sfdmu run --sourceusername source@name.com --targetusername target@name.com
  • For import data from CSV files:
$ sf sfdmu run --sourceusername csvfile --targetusername target@name.com
  • For export data into CSV files:
$ sf sfdmu run --sourceusername source@name.com --targetusername csvfile
Notes:
  • When installing the SFDMU on MacOS you can sometimes run into a permission issue. If so, just prepend all above command with "sudo", e.g.:

    $ sudo sf plugins install sfdmu

  • All examples are provided with the assumption that you are using the current SF CLI platform. However, if you are operating under the outdated SFDX CLI platform, you should replace sf by sfdx and : by a space, for example: sfdx plugins:install sfdmu instead of sf plugins install sfdmu

Watch the demo. The SFDMU in action.

Last updated on 13th Apr 2024