Running.


Table of Contents



Simplest Way to Run the SFDMU

  • Navigate to the directory containing your export.json file.
  • Execute the following command to perform a direct migration between source and target Salesforce orgs:
$ sf sfdmu run --sourceusername source@name.com --targetusername target@name.com
  • Use this command to import data from CSV files:
$ sf sfdmu run --sourceusername csvfile --targetusername target@name.com
  • Use this command to export data into CSV files:
$ sf sfdmu run --sourceusername source@name.com --targetusername csvfile

Notes:
  • When importing or exporting from/to CSV files, ensure that the files are located in the directory containing the export.json file. The files should be named according to the API name of the respective sObject in your export.json, for example: Account.csv, Contact.csv.
    This naming convention helps in accurately mapping the data to the correct sObjects during the import or export process.

Run the SFDMU as an SFDX Plugin

The quickest way to run the SFDMU is using the sf sfdmu run CLI command, as previously explained.

Below you will find the complete details about the format of the sfdmu run command.

Full Format of the CLI Command

$ sf sfdmu run [--json] [-s <value>] [-u <value>] [-p <value>] [--file <value>] [--silent] [--quiet] [--diagnostic] [--anonymise] [--verbose] [--concise] [--logfullquery] [--apiversion <value>] [-l <value>] [-n] [-w] [--failonwarning] [-c <value>] [-m] [--loglevel <value>] [--usesf] [-v]

Available CLI Command flags

--sourceusername, -s:

Optionally, this CLI flag specifies the username for the source Salesforce organization in a data migration process. It can override the sourceUsername setting in export.json. For example:

  • Using --sourceusername "source@example.com" sets the username for the source org, enabling the SFDMU tool to connect and interact with the specified Salesforce environment for data extraction.
  • Using --sourceusername csvfile sets CSV files as the data source, allowing to import data from CSV files instead of Salesforce organization.

--targetusername, -u:

This mandatory CLI flag specifies the username for the target Salesforce organization or sets the target to CSV files in a data migration process. It can override the targetUsername setting in export.json. For example:

  • Using --targetusername "target@example.com" sets the username for the target org, enabling the SFDMU tool to connect and interact with the specified Salesforce environment for data import.
  • Using --targetusername csvfile sets the data target to export into CSV files instead of a Salesforce organization, allowing data to be output in a structured file format for storage or further processing.

--apiversion:

Type: Float (as String)

Optionally, this flag can override the apiVersion specified in export.json. For instance:

  • Setting it to "65.0" directly specifies the API version, allowing precise control over which version of the Salesforce API the migration will utilize.

If neither export.json apiVersion nor --apiversion is provided, SFDMU auto-detects:

  • org -> org: lower of max source API version and max target API version.
  • org -> csvfile or csvfile -> org: max API version of that org.

--canmodify, -c:

Allows silent modifications to the target production organization without preliminary user prompting.

This is particularly relevant when the target environment is a production instance (e.g., prod-instance.my.salesforce.com), where the plugin will not request user approval for modifications, thereby streamlining processes.

If not set, the user will be prompted to prevent accidental destruction of critical production data. This flag is ignored if the target is not a production Salesforce instance.

--filelog, -l:

Type: Number, 0 or 1, Default 0

Controls file logging. A setting of 0 disables .log output, while 1 enables .log output. When --diagnostic is set, file logging is enabled automatically.

--json:

Outputs a single JSON payload at the end of command execution and suppresses other stdout output. When --quiet or --silent is used, JSON output is also suppressed in stdout.

--diagnostic:

Enables diagnostic file logging. It writes additional diagnostic details to the .log file and forces file logging on. Stdout behavior remains unchanged.

--anonymise:

Enables anonymization for sensitive values in .log files by writing deterministic hash tokens instead of raw values (for example, accessToken<ABCDEF12AB34CD56> or path<11F2AA55CC77EE99>).

This flag affects only .log files and does not change stdout or JSON output.

Use it together with --diagnostic when sharing logs externally.

For the complete masked/non-masked list, see: /full-documentation/reports/the-execution-log#what-is-masked-and-what-is-not

--logfullquery:

Enables the full output of all selected fields when querying Salesforce data with SOQL, as opposed to the default shortened version. This detailed output is useful for comprehensive data analysis and troubleshooting.

The Plugin will still truncate the SOQL part after the FROM keyword if it exceeds a certain length, and this flag affects both stdout and file logs.

--loglevel:

Type: String, Default TRACE

Sets the logging level for this command invocation, controlling the type of messages that are written into the log file. Levels available include:

  • TRACE logs all messages, including stack traces in case of an unhandled exception.
  • DEBUG is the same as INFO.
  • WARN logs only warning messages.
  • ERROR logs only exception messages but does not output stack traces.
  • FATAL is the same as ERROR. This flag allows for detailed control over the verbosity of file logs, independent of stdout settings.

--noprompt, -n:

Suppresses user prompts for inputs or confirmations, allowing the command to proceed using default settings. This is especially useful in situations where missing lookup references are detected in object records, preventing interruptions during the migration process.

--nowarnings, -w:

Suppresses warning messages in stdout, providing a cleaner and less cluttered output, which can be essential during large-scale migrations where numerous warnings might clutter the view.

--failonwarning:

Treats any warning as an error. On the first warning, SFDMU immediately aborts execution and returns exit code 8 (WARNING_AS_ERROR).

--path, -p:

Specifies the directory containing the export.json. If this flag is not provided, the plugin searches the current directory, ensuring that the migration configuration is correctly located and utilized.

--file:

Optionally specifies an explicit export.json file path to execute.

  • If relative, it is resolved against --path.
  • If absolute, that exact file is used.
  • Other runtime folders and relative resources still remain based on --path.

When --diagnostic is enabled, the log includes the resolved export.json path and an additional line when it differs from --path.

--verbose:

Legacy flag. Deprecated and has no effect. It is kept only for compatibility with old command strings.

--concise:

Legacy flag. Deprecated and has no effect. It is kept only for compatibility with old command strings.

--quiet:

Suppresses stdout logging while still logging to a file. This option is useful in environments where console output needs to be minimized, such as in automated scripts or where output verbosity could obscure important information.

--silent:

Functionally equivalent to --quiet, this flag also suppresses stdout logging, ensuring quiet operation during migration tasks.

--usesf:

Legacy flag. Deprecated and has no effect. It is kept only for compatibility with old command strings.

--simulation, -m:

This CLI flag enables a simulation mode in the SFDMU tool, allowing users to run a migration process without actually performing any data changes in the Salesforce organizations or files involved.

It is particularly useful for testing migration configurations and understanding the behavior of the tool under specific conditions before committing to a real operation.

--version, -v:

This CLI flag, when used with the SFDMU tool, displays the current installed version of the software.

Additional Notes:

  • For MacOS users: If you encounter permission issues, prepend your command with sudo, e.g., $ sudo sf sfdmu run --targetusername MYTARGET.

Run the SFDMU on One Org Only (One-Directional Mode)

In scenarios where no source org is available and you only need to modify certain records in

the target org, provide only the --targetusername. The target org will act as both source and target.

Records are compared using the specified external ID, but it's reasonable to use the Record Id field as an External ID key.

Supported Execution Mode

SFDMU is supported to run only as an SF CLI plugin command:

$ sf sfdmu run --sourceusername source@name.com --targetusername target@name.com

Standalone Node.js application mode and Node.js module/programmatic mode are not supported.

Related Articles

Last updated on 21st Feb 2026