Newer Version Available

This content describes an older version of this product. View Latest

Override or Add Definition File Options at the Command Line

Some CLI commands, such as force:org:create and force:user:create, use a JSON definition file to determine the characteristics of the org or user they create. The definition file contains one or more options. You can override some options by specifying them as name-value pairs at the command line. You can also specify options that aren’t in the definition file. This technique allows multiple users or continuous integration jobs to share a base definition file and then customize options when they run the command.

Let’s say you use the following JSON definition file to create a scratch org. You name the file project-scratch-def.json.

1{
2  "orgName": "Acme",
3  "country": "US",
4  "edition": "Enterprise",
5  "hasSampleData": "true",
6  "features": ["MultiCurrency", "AuthorApex"],
7  "orgPreferences": {
8    "enabled": ["S1DesktopEnabled", "ChatterEnabled"],
9    "disabled": ["IsNameSuffixEnabled"]
10  }
11}

To create an Enterprise Edition scratch org that uses all the options in the file, run this command.

1sfdx force:org:create --definitionfile project-scratch-def.json

You can then use the same definition file to create a Developer Edition scratch org that doesn’t have sample data by overriding the edition and hasSampleData options.

1sfdx force:org:create --definitionfile project-scratch-def.json edition=Developer hasSampleData=false

Use commas to separate multiple array values, and enclose them in double quotes. For example, to change the features option:

1sfdx force:org:create --definitionfile project-scratch-def.json features="MultiCurrency,PersonAccounts"

This example shows how to add the adminEmail option, which doesn’t exist in the definition file.

1sfdx force:org:create --definitionfile project-scratch-def.json adminEmail=john@doe.org

You can’t override options whose values are JSON objects, such as orgPreferences.

Note