Show Menu
Cheatography

Salesforce CLI Command Reference Cheat Sheet (DRAFT) by

Salesforce CLI Command Reference

This is a draft cheat sheet. It is a work in progress and is not finished yet.

sf alias

sf alias list
List all aliases currently set on your local computer.
sf alias set alias='value'
Set one or more aliases on your local computer.
sf alias unset alias my-oth­er-­alias
Unset one or more aliases that are currently set on your local computer.
[-a|-all] : Unset all currently set aliases.
[-p|--­no-­prompt] : Don't prompt the user for confir­mation when unsetting all alliases.

sf config

sf config get CONFIG­_VA­RIABLE [--ver­bose]
Get the value of a config­uration variable.
--verbose : Display whether the config­uration variables are set locally or globally.
sf config list
List the config­uration variables that you've previously set.
sf config set CONFIG­_VA­RIA­BLE­=NE­W_VALUE [-g|--­global]
Set one or more config­uration variables, such as your default org.
[-g|--­global] : Set the config­uration variables globally, so they can be used from any Salesforce DX project.
sf config unset CONFIG­_VA­RIABLE [-g|--­global]
Unset local or global config­uration variables.
[-g|--­global] : Unset the config­uration variables globally.
CONFIG­_VA­RIABLE can be multiple variables separated by space, e.g., target-org api-ve­rsion.

Config­uration Variables

org-ap­i-v­ersion
The API version for a specific project or all projects. Normally, Salesforce CLI assumes that you’re using the same version of the CLI as the Dev Hub org.
target-org
The username or alias for an org that all commands run against by default.
target­-de­v-hub
The username or alias for your default Dev Hub org.
 

sf org create

sf org create sandbox
Create a sandbox org.
sf org create scratch
Create a scratch org
sf org create shape
Create a scratch org config­uration (shape) based on the specified source org.
sf org create snapshot
Create a snapshot of a scratch org.
sf org create user
Create a user for a scratch org.

sf project deploy [[WIP]]

project deploy preview
Preview a deployment to see what will deploy to the org, the potential conflicts, and the ignored files.
project deploy start
Deploy metadata to an org from your local project.
project deploy validate
Validate a metadata deployment without actually executing it.
project deploy resume
Resume watching a deploy operation and update source tracking when the deploy completes.
project deploy cancel
Cancel a deploy operation.
Universal attrib­utes:
[-o|--­tar­get­-org] : Username or alias of the target org.

Salesforce CLI Command Reference: project Commands

sf org login

sf org login access­-token
Authorize an org using an existing Salesforce access token.
-r|--i­nst­anc­e-url INSTAN­CE-URL
URL of the instance that the org lives on.
If you specify an --inst­anc­e-url value, this value overrides the sfdcLo­ginUrl value in your sfdx-p­roj­ect.json file.
To specify a My Domain URL, use the format "https://<MyDomainName>.my.salesforce.com".
To specify a sandbox, set --inst­anc­e-url to "­htt­ps:­//<­MyD­oma­inN­ame­>--­<Sa­ndb­oxN­ame­>.s­and­box.my.sa­les­for­ce.c­om­".
sf org login device
Authorize an org using a device code.
sf org login jwt
Log in to a Salesforce org using a JSON web token (JWT).
sf org login sfdx-url
Authorize an org using a Salesforce DX author­ization URL stored in a file or through standard input (stdin).
sf org login web
Log in to a Salesforce org using the web server flow.
Universal attrib­utes:
[-a|--­alias] : Alias for the org.
[-s|--­set­-de­fault] : Set the authen­ticated org as the default that all org-re­lated commands run against.
[-d|--­set­-de­fau­lt-­dev­-hub] : Set the authen­ticated org as the default Dev Hub.