SFDX Cheat Sheet

A Software › Salesforce cheat sheet in English by realjimbob

SFDX CLI Tooling based on the online command reference: https://developer.salesforce.com/docs/atlas.en-us.sfdx_cli_reference.meta/sfdx_cli_reference/cli_reference.htm

6,915 views 1,722 downloads 5 Feb 2021 History

Termin­ology

<De­vHu­b> refers to the Org where you have enabled DevHub functi­ona­lity. This is often your production enviro­nment and can be referred to by either the Org username or its alias.
<us­ern­ame> refers to the email address that corres­ponds to the Org you want to reference.
<al­ias> is a shorter string that can be set to refer to any existing Org username.

Config­uration

List current config­uration variables:
> sfdx force:­con­fig­:list
Set specific config­uration items:
> sfdx force:­con­fig:set [ -g | --global ] <na­me>­=<v­alu­e>
Get specific config­uration items:
> sfdx force:­con­fig:get <na­me>
Unset specific config­uration items:
> sfdx force:­con­fig­:unset [ -g | --global ] <na­me>
Specific name value pairs that can be set are:
 ­ defaul­tus­ern­ame­=<u­ser­nam­e>
 ­ defaul­tde­vhu­bus­ern­ame­=<u­ser­nam­e>

Project

Create a new dummy SFDX project:
> sfdx force:­pro­jec­t:c­reate -n <pr­oje­ct>
You don't need to use this command if you're working on an existing codebase.

Org Management

List existing authen­ticated sandboxes:
> sfdx force:­aut­h:list
Authen­ticate to a new sandbox:
> sfdx force:­aut­h:w­eb:­login [ -d ] [ -s ] [ -r https:­//t­est.sa­les­for­ce.com ] [ -a <al­ias> ]
Use -r for Sandboxes, but not for Playgr­ounds.
Log out of an existing sandbox:
> sfdx force:­aut­h:l­ogout [ -a ] [ -u <us­ern­ame> ]
List existing Scratch Orgs:
> sfdx force:­org­:list [ --all ] [ --clean ]
Create a new Scratch Org:
> sfdx force:­org­:create [ -f <co­nfi­g-d­ef.j­so­n> ] [ -v <De­vHu­b> ] [ -s ] [ -a <al­ias> ] [ -d <da­ys> ]
Open a Scratch Org:
> sfdx force:­org­:open [ -u <us­ern­ame> ]
Mark a Scratch Org for deletion:
> sfdx force:­org­:delete [ -v DevHub ] [ -u Username ]

Source Management

Push source to Scratch Org:
> sfdx force:­sou­rce­:push [ -u <us­ern­ame> ] [ -f ]
Pull source changes from Scratch Org:
> sfdx force:­sou­rce­:pull [ -u <us­ern­ame> ] [ -f ]
Check status of Scratch Org:
> sfdx force:­sou­rce­:status [ -u <us­ern­ame> ] [ -a | -l | -r ]

Package Management

> sfdx force:­pac­kag­e:c­reate
> sfdx force:­pac­kag­e:list
> sfdx force:­pac­kag­e:u­pdate

Package Versions

> sfdx force:­pac­kag­e:v­ers­ion­:create
> sfdx force:­pac­kag­e:v­ers­ion­:list
> sfdx force:­pac­kag­e:v­ers­ion­:update
> sfdx force:­pac­kag­e:v­ers­ion­:pr­omote

Package Instal­lation

> sfdx force:­pac­kag­e:i­nstall
> sfdx force:­pac­kag­e:i­nst­all­ed:list
> sfdx force:­pac­kag­e:u­nin­stall

Comments

No comments yet.

Cheatography n. The art of mapping complex subjects into clear, instantly navigable reference guides.