Salesforce CLI: Join the Evolution

The Salesforce command-line interface (CLI) continues to evolve with more features and commands that support the Salesforce DX development models. Use it to easily create environments for development and testing, synchronize source code, run tests, and control the full application life cycle. These new and changed features are available when Salesforce CLI v44 is released on October 13, 2018.

Where: This change applies to Lightning Experience, Salesforce Classic, and all versions of the Salesforce app in all editions.

We release changes to Salesforce CLI regularly. Read the weekly release notes to learn about recent updates for version 44 of the CLI. These commands and parameters have changed in version 44 or during version 43 weekly updates. For more information, see version 44 of the Salesforce CLI Command Reference.

Uninstall the Pre-Release Version of the CLI

If you installed the pre-release version 44 of the CLI, uninstall it, then run the update command.
sfdx plugins:uninstall salesforcedx
sfdx update

New Commands

These new commands are available in Salesforce CLI v44.

The force:source:deploy, force:source:retrieve, and force:source:delete commands work on sandboxes, Developer Edition orgs, and trial orgs, but not production orgs. For production orgs, continue to use force:mdapi:deploy and force:mdapi:retrieve.

force:source:delete (beta)
Deletes metadata from a non-source-tracked org, such as a sandbox, and from your local project. You can indicate a comma-delimited list of local paths or of individual metadata components.
force:source:deploy (beta)
Deploys source from your project to a non-source-tracked org. Unlike the force:source:push command for scratch orgs (source-tracked orgs), you indicate the specific set of metadata to deploy. This command overwrites all corresponding metadata in the org with the deployed local files.
force:source:retrieve (beta)
Retrieves source from a non-source-tracked org to your project. Unlike the force:source:pull command for scratch orgs (source-tracked orgs), with force:source:retrieve you indicate the specific set of metadata to retrieve. This command overwrites all local files with the metadata retrieved from the org.
Note

Note

As a beta feature, the non-source-tracked org commands are a preview and aren’t part of the “Services” under your master subscription agreement with Salesforce. Use this feature at your sole discretion, and make your purchase decisions only on the basis of generally available products and features. Salesforce doesn’t guarantee general availability of this feature within any particular time frame or at all, and we can discontinue it at any time. This feature is for evaluation purposes only, not for production use. It’s offered as is and isn’t supported, and Salesforce has no liability for any harm or damage arising out of or in connection with it. All restrictions, Salesforce reservation of rights, obligations concerning the Services, and terms for related Non-Salesforce Applications and Content apply equally to your use of this feature. You can provide feedback and suggestions for the non-source-tracked org commands in the Salesforce DX Trailblazer Community.

The Scratch Org Snapshot commands are available as part of an invitation-only pilot in late October 2018.

force:org:snapshot:create (pilot)
Creates a snapshot of an existing scratch org to use as a basis for scratch org creations. A snapshot reflects the state of a scratch org when the snapshot is created. It contains scratch org shape information (edition, features, and licenses), installed packages, metadata, and test data.
force:org:snapshot:delete (pilot)
Deletes a snapshot.
force:org:snapshot:get (pilot)
Returns information for a specified snapshot.
force:org:snapshot:list (pilot)
Lists all snapshots associated with a Dev Hub.
Note

Note

We provide Scratch Org Snapshot to selected customers through a pilot program that requires agreement to specific terms and conditions. To be nominated to participate in the program, contact Salesforce. Pilot programs are subject to change, and we can’t guarantee acceptance. Scratch Org Snapshot isn’t generally available unless or until Salesforce announces its general availability in documentation or in press releases or public statements. We can’t guarantee general availability within any particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features. For information on enabling this feature in your org, contact Salesforce.

Changed Commands

The functionality for these commands changed in Salesforce CLI v44.

force:mdapi:convert
This command escapes double quotes when converting from Metadata API format to the source format.
force:package:install, force:package:uninstall
If you run these commands using the package version alias, you must run them from within a Salesforce DX project folder. If you specify the package version ID (which starts with 04t), you can run them outside of a DX project.
force:package:version:list
The output includes a new column that indicates whether the package version is protected by an installation key.
force:source:push
Deployment errors show the project path.
force:source:pull
If a metadata name has special characters (such as forward slashes, backslashes, quotation marks), we encode the file name on the local file system for all operating systems. For example, if you pull a custom profile called Custom: Marketing Profile, the colon is encoded in the resulting file name.
Custom%3A Marketing Profile.profile-meta.xml
If you reference a file name with special characters in .forceignore, use the encoded file name.

If you use package version IDs instead of aliases, you can now use 04t package IDs for all force:package:version commands instead of a mix of 04t (subscriber package version) and 05i (package version) IDs. However, we strongly recommend using aliases for all force:package commands and in the sfdx-project.json file.

  • The output displays only the 04t IDs for package:version:create, package:version:update, package:version:list, and package:version:report.
  • You can use either 04t or 05i IDs when running package:version:updatepackage:version:promote, or package:version:report.
  • You can use either 04t or 05i IDs as the ancestor ID in the sfdx-project.json file.
  • You can view 05i IDs for package:version:list and package:version:report if you use the --verbose parameter.

New Parameters

This command has a new parameter in Salesforce CLI v44.

force:project:create
Use the --manifest | -x parameter to generate a default manifest (package.xml) for fetching Apex, Visualforce, Lightning components, and static resources.

Changed Parameters

These parameters have changed in Salesforce CLI v44.

force:package:create --path | -r
The --path | -r parameter is required. This parameter ignores trailing slashes. For example, the CLI treats both force-app and force-app/ the same.
force:package:version:update
We renamed several parameters to make them consistent with the parameters for force:package:version:create.
Previous Parameter Current Parameter
--name | -n --versionname | -a
--description | -d --versiondescription | -e
--package2versionid | -i --package | -p

Package Version in Salesforce DX Project File

You can indicate a package version with a build number when defining a dependent package in the sfdx-project.json file. Previously, you had to indicate the LATEST keyword as the build number.

"dependencies": [
   {
       "package": "0Hoxxx",
       "versionNumber": "1.1.0.3"
   }
]

New Environment Variable

Normally, when you run some CLI commands, a temporary directory with all the metadata is created then deleted upon successful completion of the command. However, retaining these files can be useful for several reasons. You can debug problems that occur during command execution. You can use the generated package.xml when running subsequent commands, or as a starting point for creating a manifest that includes all the metadata you care about.

To retain all the metadata in a specified directory path when you run these commands, set the SFDX_MDAPI_TEMP_DIR environment variable:

  • force:source:deploy
  • force:source:retrieve
  • force:source:delete
  • force:source:push
  • force:source:pull
  • force:source:convert
  • force:org:create (if your scratch org definition contains scratch org settings, not org preferences)

Example:

SFDX_MDAPI_TEMP_DIR=/users/myName/myDXProject/metadata