ABCDEFGHIJKLMNOPQRSTUVWXYZ
1
CategoryCommand forSFDX CommandSF Command
2
Generallist all the commandssfdx commandssf commands
3
help with any commandsfdx --helpsf --help
4
One more sub levelsfdx force:org --helpsf org --help
5
Generate the password for a scratch org usersf org generate password --length 12 --target-org my-scratch
6
Generate a password for the specified users in the default scratch orgsf org generate password --on-behalf-of user1@my.org --on-behalf-of user2@my.org --on-behalf-of user3@my.org
7
Generate the package.xml file to include all the metadata from your Salesoforce orgsfdx force source manifest create --from-org [your-org-username-here or alias here] --name=allMetadata --output-dir manifestsf force source manifest create --from-org your-org-alias --name=allMetadata --output-dir manifest
8
9
10
Author­izationAuthorize an Org set with an alias and make it the default Dev Hubsfdx auth:web:login -a TestOrg1 - dsf auth web login --set-default-dev-hub --alias dev-hub
11
Log in to a sandbox and set it as your default orgsfdx auth:web:login -r https://MyDomainName--SandboxName.sandbox.my.salesforce.comsf auth web login --instance-url https://MyDomainName--SandboxName.sandbox.my.salesforce.com --set-default
12
Use your own connected app by specifying its consumer key (also called
client ID)
sf auth web login --instance-url https://MyDomainName--SandboxName.sandbox.my.salesforce.com --set-default --browser chrome --client-id 04580y4051234051
13
Set default DevHubsfdx force:­con­fig:set defaul­tde­vhu­bus­ern­ame­=yourusername@org.comsf config set target-dev-hub=me@my.com
14
Set Default Orgsfdx force:­con­fig:set defaul­tus­ern­ame­=yourusername@org.comsf config set target-org=me@my.org

sf config set target-org=my-scratch-org
15
List All the configurationsfdx force:­con­fig­:listsf config list
16
Authorize using JWTsfdx auth:jwt:grant --username jdoe@example.org --jwtkeyfile /Users/jdoe/JWT/server.key --clientid 123456 --setdefaultdevhubusernamesf org login jwt --username jdoe@example.org --jwt-key-file /Users/jdoe/JWT/server.key --client-id 123456 --set-default-dev-hub
17
18
19
Orglist all the orgssfdx force:org:listsf org list
20
Open an org with alias namesfdx force:org:opensf org open --target-org MyOrgName
21
Create Scratch org for 30 dayssfdx force:org:create -a MyAlias -s -f config/project-scratch-def.json -d 30sf org create scratch --target-dev-hub MyHub --definition-file config/project-scratch-def.json --set-default --duration-days 30
22
Generate the package.xml file to include all the metadata from your Salesoforce orgsfdx force source manifest create --from-org [your-org-username-here or alias here] --name=allMetadata --output-dir manifestsf force source manifest create --from-org greybook+ffbox --name=allMetadata --output-dir manifest
23
24
25
MetadataDeploy the code to Scratch orgsfdx force:source:pushsf project deploy start
26
Deploy all components listed in a manifest to Scratch Orgsfdx force:source:pushsf project deploy start --manifest path/to/package.xml
27
Pull Changes from Scratch orgsfdx force:source:pullsf project retrieve start
28
Retrieve all metadata components listed in a manifestsfdx force:source:retrieve -x manifest/package.xmlsf project retrieve start --manifest path/to/package.xml
29
Retrieve all metadata components listed in a packagesfdx force:source:retrieve --packagenames MyPackageName --retrievetargetdir path/to/unpackaged

sfdx force:source:retrieve --packagenames MyPackageName
sf project retrieve start --package-name MyPackageName
30
31
32
DataImport the records contained in two JSON files into the org with alias "my-scratch"sf data import tree --files Contact.json,Account.json --target-org my-scratch
33
Import records using a plan definition file into your default orgsf data import tree --plan Account-Contact-plan.json
34
Export records retrieved with the specified SOQL query into a single JSON file in the current directory; the command uses your default
org
sf data export tree --query "SELECT Id, Name, (SELECT Name, Address__c FROM Properties__r) FROM Broker__c"
35
Export data using a SOQL query in the "query.txt" file and generate JSON files for each object and a plan that aggregates themsf data export tree --query query.txt --plan
36
Prepend "export-demo" before each generated file and generate the files in the "export-out" directory; run the command on the org with
alias "my-scratch"
sf data export tree --query query.txt --plan --prefix export-demo --output-dir export-out --target-org my-scratch
37
Specify a SOQL query at the command linesf data query --query "SELECT Id, Name, Account.Name FROM Contact"
38
Read the SOQL query from a file called "query.txt"sf data query --file query.txt --target-org my-scratch
39
Use Tooling API to run a query on the ApexTrigger Tooling API objectsf data query --query "SELECT Name FROM ApexTrigger" --use-tooling-api
40
for more commands run "sf data --help" in the commands or terminal and you will see all the commands there
41
42
43
PackageCreate an unlocked package from the files in the "force-app" directorysf package create --name MyUnlockedPackage --package-type Unlocked --path force-app
44
Create a managed packaged from the "force-app" directory files, give the package a description, and use the specified Dev Hub orgsf package create --name MyManagedPackage --description "Your Package Descripton" --package-type Managed --path force-app \
--target-dev-hub devhub@example.com
45
Create a package version from a package with the specified aliassf package version create --package "Your Package Alias" --installation-key password123 --target-dev-hub devhub@example.com
46
Create a package version from a package with the specified IDsf package version create --package 0Ho... --installation-key password123
47
Create a package version and skip the validation stepsf package version create --path common --installation-key password123 --skip-validation
48
Promote the package version with the specified ID to releasedsf package version promote --package 04t...
49
Promote the package version with the specified alias to releasedsf package version promote --package awesome_package_alias --target-dev-hub devhub@example.com
50
sf package version promote --package "Awesome Package Alias"
51
Install a package version with the specified ID in the org with username "me@example.com"sf package install --package 04t... --target-org me@example.com
52
for more commands run "sf package --help" in the commands or terminal and you will see all the commands there
53
54
55
Detla DeploymentInstall the sfdx git delta pluginsfdx plugins:install sfdx-git-deltasf plugins install sfdx-git-delta
56
Generate Package.xml for delta filessfdx sgd:source:delta --to "HEAD" --from "HEAD~1" --output "."sf sgd source delta --to "HEAD" --from "HEAD~1" --output "./delta" --ignore-whitespace -d -i .sgdignore
57
Deploy the Delta files to Salesforcesfdx force:source:deploy -x package/package.xml --postdestructivechanges destructiveChanges/destructiveChanges.xmlsf project deploy start --manifest delta/package/package.xml --test-level RunLocalTests --target-org HubOrg --coverage-formatters clover
58
59
60
PluginsInstall a pluginsfdx plugins:install sfdx-git-deltasf plugins install sfdx-git-delta
61
Unstall a pluginsfdx plugins:uninstall sfdx-git-deltasf plugins uninstall plugin-name
62
63
64
ScannerInstall SFDX Scannersfdx plugins:install @salesforce/sfdx-scannersf plugins install @salesforce/sfdx-scanner
65
Run SFDX CLI Scanner to scan the codesfdx scanner:run -f html -t "force-app" -e "eslint,retire-js,pmd,cpd" -c "Design,Best Practices,Code Style,Performance,Security" --outfile ./reports/scan-reports.htmlsf scanner run -f html -t "force-app" -e "eslint,retire-js,pmd,cpd" -c "Design,Best Practices,Code Style,Performance,Security" --outfile ./reports/scan-reports.html
66
for more commands run "sf scanner run --help" in the commands or terminal and you will see all the commands there
67
68
69
UserAssign Permission Set to Usersf org assign permset --name DreamHouse --target-org your-org-username
70
Assign multiple permission set to the user sf org assign permset --name DreamHouse --name CloudHouse --target-org your-org-username
71
Assign the Dreamhouse permission set to the specified list of usersf org assign permset --name DreamHouse --on-behalf-of user1@my.org --on-behalf-of user2 --on-behalf-of user
72
73
74
Most Frequently usedPull the metadata from the org using package.xmlsf project retrieve start --manifest path/to/package.xml
75
Deploy the metadata to the org using package.xmlsf project deploy start --manifest path/to/package.xml
76
Deploy the source files in a directory to an orgsf project deploy start --source-dir path/to/source --target-org my-scratch
77
Deploy all custom objects and Apex classessf project deploy start --metadata CustomObject ApexClass
78
Deploy a specific Apex classsf project deploy start --metadata ApexClass:MyApexClass
79
Deploy the metadata to the org using package.xml and run test local casessf project deploy start --manifest path/to/package.xml --test-level=RunLocalTests
80
Deploy the metadata to the org using package.xml and run specified test local casessf project deploy start --manifest path/to/package.xml --test-level=RunSpecifiedTests --tests=Test1 Test2 "Test With Space"
81
Generate the password for a scratch org usersf org generate password --length 12 --target-org my-scratch
82
Generate a password for the specified users in the default scratch orgsf org generate password --on-behalf-of user1@my.org --on-behalf-of user2@my.org --on-behalf-of user3@my.org
83
Generate the package.xml file to include all the metadata from your Salesoforce orgsfdx force source manifest create --from-org [your-org-username-here or alias here] --name=allMetadata --output-dir manifestsf force source manifest create --from-org greybook+ffbox --name=allMetadata --output-dir manifest
84
Install SFDX Scannersfdx plugins:install @salesforce/sfdx-scannersf plugins install @salesforce/sfdx-scanner
85
Run SFDX CLI Scanner to scan the codesfdx scanner:run -f html -t "force-app" -e "eslint,retire-js,pmd,cpd" -c "Design,Best Practices,Code Style,Performance,Security" --outfile ./reports/scan-reports.htmlsf scanner run -f html -t "force-app" -e "eslint,retire-js,pmd,cpd" -c "Design,Best Practices,Code Style,Performance,Security" --outfile ./reports/scan-reports.html
86
Generate Package.xml for delta filessfdx sgd:source:delta --to "HEAD" --from "HEAD~1" --output "."sf sgd source delta --to "HEAD" --from "HEAD~1" --output "./delta" --ignore-whitespace -d -i .sgdignore
87
Deploy the Delta files to Salesforcesfdx force:source:deploy -x package/package.xml --postdestructivechanges destructiveChanges/destructiveChanges.xmlsf project deploy start --manifest delta/package/package.xml --test-level RunLocalTests --target-org HubOrg --coverage-formatters clover
88
89
90
91
92
93
94
95
96
97
98
99
100