Be More Productive with the Salesforce CLI (Generally Available)

The Salesforce command-line interface (CLI) combines many capabilities from across several Salesforce APIs. It also incorporates the functionality of other Salesforce tools, such as the Force.com Migration Tool and Salesforce workbench. All in one place. Easily create environments for development and testing, synchronize source code, create and run tests, and control the full application life cycle. And like all CLIs, it’s scriptable. The Salesforce CLI will be generally available in mid-October 2017.

Changes to the Salesforce CLI are released regularly. Read the weekly release notes to learn about the new and changed features in recent updates.

These commands and parameters have changed in version 41 of the Salesforce CLI or during weekly updates after we published version 40 of the Salesforce CLI Command Reference (Beta). For more information, see version 41 of the Salesforce CLI Command Reference.

System Requirement Changes

If you are running the CLI on Windows, Powershell is no longer required.

Deprecated Environment Variables

We are deprecating SFDX_DISABLE_ENCRYPTION in Spring '18. You can continue to use this environment variable in Winter '18 but will see a deprecation warning when you run CLI commands. Before you start using Spring '18, we strongly recommend that you unset this variable, and then reauthorize all your orgs.

New Commands

lightning:test:install
Installs a Lightning Testing Service (LTS) unmanaged package into your org.
mdapi:deploy:report
Checks the status of an asynchronous metadata deployment.
mdapi:retrieve:report
Checks the status of an asynchronous metadata retrieval.
org:shape:create (pilot)
Available to participants in an invitation-only pilot program. Creates a snapshot of org edition, features, and licenses to use for scratch org creation, allowing your scratch org to look like another org for testing.
org:shape:delete (pilot)
Available to participants in an invitation-only pilot program. Deletes all org shapes that you’ve created for an org using the Salesforce CLI.
org:shape:list (pilot)
Available to participants in an invitation-only pilot program. Lists all org shapes that you’ve created using the Salesforce CLI.
package:installed:list
Lists all packages installed in the target org.
package:uninstall
Uninstalls a second-generation package in the target org.
package:uninstall:get
Retrieves the status of a package uninstall request.
package2:update (beta)
Updates a second-generation package.
user:create
Creates a user for a scratch org.
user:display
Displays information about a user of a scratch org that the Salesforce CLI has created or authenticated.
user:list
Lists all users of a scratch org that the Salesforce CLI has created or authenticated.

Removed Pilot Commands

package2:installed:list
You can now use the package:installed:list command with second-generation packages.
package2:manifest:create
package2:members:list
package2:version:install
You can now use the package:install command with second-generation packages.
package2:version:uninstall
You can now use the package:uninstall command with second-generation packages.

New Parameters

apex:test:run: -y | --synchronous
Optional. Runs test methods from a single Apex class synchronously. If you don’t specify this flag, tests are run asynchronously.
data:record:create: -t | --usetoolingapi
Optional. Creates a record of a Tooling API object.
data:record:delete: -t | --usetoolingapi
Optional. Deletes a record of a Tooling API object.
data:record:get: -t | --usetoolingapi
Optional. Retrieves a record of a Tooling API object.
data:record:update: -t | --usetoolingapi
Optional. Updates a record of a Tooling API object.
data:record:update: -v | --targetdevhubusername
Optional. A username for the target Dev Hub org. Overrides the default Dev Hub org.
mdapi:deploy
-o | --ignoreerrors
Optional. Ignores the deploy errors, and continues with the deploy operation. The default is false. Keep this parameter set to false when deploying to a production org. If set to true, components without errors are deployed, and components with errors are skipped.
-g | --ignorewarnings
Optional. If a warning occurs and ignoreWarnings is set to true, the success field in DeployMessage is true. When ignoreWarnings is set to false, success is set to false, and the warning is treated like an error.
org:create
-c | --noancestors
Optional. Prevents the inclusion of second-generation package ancestors in the scratch org.
-d | --durationdays
Optional. Sets the duration of the scratch org, in days. Valid values are 1–30. The default is seven days.
package:install: -p | --publishwait
Optional. Maximum number of minutes to wait for the Subscriber Package Version ID to replicate to the target org before canceling the install request. The default is 0.
package2:create (beta): -o | --containeroptions
Optional. Determines the upgrade and editability rules for the second-generation package.
package2:version:create (beta): -k | --installationkey
Optional. Installation key for creating the key-protected package. The default is null.
package2:version:update (beta): -k | --installationkey
Optional. Installation key for the key-protected package. The default is null.
user:password:generate: -o | --onbehalfof
Optional. A comma-separated list of usernames for which to generate passwords.
user:permset:assign: -o | --onbehalfof
Optional. Comma-separated list of usernames to assign the permission set to.

Changed Parameters

package2:version:create (beta): -d | --directory
Changed from required to optional. The path to the directory that contains the contents of the package2 version.