force:org:* Commands Migration
This table summarizes the mapping between the existing force:org:* commands and their new sf-style equivalents. The usage notes indicate if the mapping is one-to-one. If it is, you migrate them by changing their command and flag names as listed in the reference page for each force:org:* command. Some command migrations require more changes, as described in the usage notes. For more guidance, see the examples after the table.
force:org:* Command | Equivalent sf-Style Command | Usage Notes |
---|---|---|
force:org:clone | org create sandbox | To clone a sandbox, specify the --clone flag of
the org create sandbox command and
set it to the name of the sandbox being cloned. To specify the new
sandbox’s name, use the --name flag
t. These two flags replace the SandboxName and SourceSandboxName key value pairs that you could specify with the force:org:clone command. See examples later in this section. |
force:org:create | org create scratch or org create sandbox | We provide two commands to create an org, one for sandbox and one for scratch
org. You can no longer specify key-value pairs, such as sandboxName=FullSbx, from the scratch or sandbox configuration file at the command line. You must either use the provided flags or update the definition file. See examples later in this section. |
force:org:delete | org delete scratch or org delete sandbox | We provide two commands to delete an org, one for sandbox and one for scratch org. |
force:org:display | org display | One-to-one mapping |
force:org:list | org list | One-to-one mapping |
force:org:open | org open | One-to-one mapping |
force:org:status | org resume sandbox | The force:org:status command did more than report the status of a sandbox create, it also resumed a sandbox create if it wasn’t complete. We now provide an explicit command to resume the org creation, which is more intuitive. To specify the incomplete sandbox creation job, use the --job-id or --use-most-recent flags. |
We also introduced the command org resume scratch to resume a scratch org creation if it times out. Previously, you could no longer connect to it, and you manually deleted it from your Dev Hub org. Now you can resume where it left off using a job ID or the --use-most-recent flag. When the org creation finishes, the command automatically authenticates to the org, saves the org info locally, and deploys any configured settings.
A few examples can help you get started with these new commands.
Let’s start with the deprecated force:org:create command. The reference tells you to use either org create sandbox or org create scratch, depending on what you want to create. Let’s say you want to migrate this force command.
sfdx force:org:create --definitionfile config/scratch-def.json --setalias MyScratchOrg --targetdevhubusername MyDevHub --nonamespace --setdefaultusername
Because the command creates a scratch org, use this equivalent sf command.
sf org create scratch --definition-file config/scratch-def.json --alias MyScratchOrg --target-dev-hub MyDevHub --no-namespace --set-default
This force example specifies scratch org options as key-value pairs at the command line, which is no longer allowed.
sfdx force:org:create adminEmail=me@email.com edition=Developer username=admin_user@orgname.org --country=GB --targetdevhubusername MyDevHub
In the sf-style equivalent, use the --edition, --admin-email, and --username flags instead. But because country doesn’t have an equivalent flag, you must specify a scratch org definition file that contains the country option. Here’s what the new command looks like.
sf force:org:create --definition-file config/scratch-def.json --admin-email me@email.com --edition=developer --username=admin_user@orgname.org --targetdevhubusername MyDevHub
In the previous example, the --edition flag takes lowercase values for Salesforce editions. To see the full list of valid editions, run org create scratch -h.
Here’s an example of a scratch org definition file that contains the country option.
{
"orgName": "Dreamhouse",
"edition": "Developer",
"country": "GB",
"features": ["Walkthroughs", "EnableSetPasswordInApi"],
"settings": {
"lightningExperienceSettings": {
"enableS1DesktopEnabled": true
},
"mobileSettings": {
"enableS1EncryptedStoragePref2": false
}
}
}
This force example creates a sandbox.
sfdx force:org:create --type sandbox --definitionfile config/dev-sandbox-def.json --setalias MyDevSandbox --targetusername ProdOrg
Here’s the equivalent sf-style command.
sf org create sandbox --definition-file config/dev-sandbox-def.json --alias MyDevSandbox --target-org ProdOrg
This force example clones a sandbox by specifying the SourceSandboxName and SandboxName key-value pairs at the command line.
sfdx force:org:clone --type sandbox SourceSandboxName=ExistingSandbox SandboxName=NewClonedSandbox --setalias MyDevSandbox --targetusername ProdOrg
In the sf-style command, use flags instead.
sf org create sandbox --clone ExistingSandbox --name NewClonedSandbox --alias MyDevSandbox --target-org ProdOrg
This force example deletes a scratch org.
sfdx force:org:delete --targetusername MyScratchOrg --noprompt
Here’s the equivalent sf-style command.
sf org delete scratch --target-org MyScratchOrg --no-prompt