A | B | C | D | E | F | G | H | I | J | K | L | M | N | O | P | Q | R | S | T | U | V | W | X | Y | Z | |
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | Category | Command for | SFDX Command | SF Command | ||||||||||||||||||||||
2 | General | list all the commands | sfdx commands | sf commands | ||||||||||||||||||||||
3 | help with any command | sfdx --help | sf --help | |||||||||||||||||||||||
4 | One more sub level | sfdx force:org --help | sf org --help | |||||||||||||||||||||||
5 | Generate the password for a scratch org user | sf org generate password --length 12 --target-org my-scratch | ||||||||||||||||||||||||
6 | Generate a password for the specified users in the default scratch org | sf 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 org | sfdx force source manifest create --from-org [your-org-username-here or alias here] --name=allMetadata --output-dir manifest | sf force source manifest create --from-org your-org-alias --name=allMetadata --output-dir manifest | |||||||||||||||||||||||
8 | ||||||||||||||||||||||||||
9 | ||||||||||||||||||||||||||
10 | Authorization | Authorize an Org set with an alias and make it the default Dev Hub | sfdx auth:web:login -a TestOrg1 - d | sf auth web login --set-default-dev-hub --alias dev-hub | ||||||||||||||||||||||
11 | Log in to a sandbox and set it as your default org | sfdx auth:web:login -r https://MyDomainName--SandboxName.sandbox.my.salesforce.com | sf 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 DevHub | sfdx force:config:set defaultdevhubusername=yourusername@org.com | sf config set target-dev-hub=me@my.com | |||||||||||||||||||||||
14 | Set Default Org | sfdx force:config:set defaultusername=yourusername@org.com | sf config set target-org=me@my.org sf config set target-org=my-scratch-org | |||||||||||||||||||||||
15 | List All the configuration | sfdx force:config:list | sf config list | |||||||||||||||||||||||
16 | Authorize using JWT | sfdx auth:jwt:grant --username jdoe@example.org --jwtkeyfile /Users/jdoe/JWT/server.key --clientid 123456 --setdefaultdevhubusername | sf 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 | Org | list all the orgs | sfdx force:org:list | sf org list | ||||||||||||||||||||||
20 | Open an org with alias name | sfdx force:org:open | sf org open --target-org MyOrgName | |||||||||||||||||||||||
21 | Create Scratch org for 30 days | sfdx force:org:create -a MyAlias -s -f config/project-scratch-def.json -d 30 | sf 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 org | sfdx force source manifest create --from-org [your-org-username-here or alias here] --name=allMetadata --output-dir manifest | sf force source manifest create --from-org greybook+ffbox --name=allMetadata --output-dir manifest | |||||||||||||||||||||||
23 | ||||||||||||||||||||||||||
24 | ||||||||||||||||||||||||||
25 | Metadata | Deploy the code to Scratch org | sfdx force:source:push | sf project deploy start | ||||||||||||||||||||||
26 | Deploy all components listed in a manifest to Scratch Org | sfdx force:source:push | sf project deploy start --manifest path/to/package.xml | |||||||||||||||||||||||
27 | Pull Changes from Scratch org | sfdx force:source:pull | sf project retrieve start | |||||||||||||||||||||||
28 | Retrieve all metadata components listed in a manifest | sfdx force:source:retrieve -x manifest/package.xml | sf project retrieve start --manifest path/to/package.xml | |||||||||||||||||||||||
29 | Retrieve all metadata components listed in a package | sfdx 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 | Data | Import 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 org | sf 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 them | sf 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 line | sf 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 object | sf 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 | Package | Create an unlocked package from the files in the "force-app" directory | sf 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 org | sf 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 alias | sf 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 ID | sf package version create --package 0Ho... --installation-key password123 | ||||||||||||||||||||||||
47 | Create a package version and skip the validation step | sf package version create --path common --installation-key password123 --skip-validation | ||||||||||||||||||||||||
48 | Promote the package version with the specified ID to released | sf package version promote --package 04t... | ||||||||||||||||||||||||
49 | Promote the package version with the specified alias to released | sf 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 Deployment | Install the sfdx git delta plugin | sfdx plugins:install sfdx-git-delta | sf plugins install sfdx-git-delta | ||||||||||||||||||||||
56 | Generate Package.xml for delta files | sfdx 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 Salesforce | sfdx force:source:deploy -x package/package.xml --postdestructivechanges destructiveChanges/destructiveChanges.xml | sf project deploy start --manifest delta/package/package.xml --test-level RunLocalTests --target-org HubOrg --coverage-formatters clover | |||||||||||||||||||||||
58 | ||||||||||||||||||||||||||
59 | ||||||||||||||||||||||||||
60 | Plugins | Install a plugin | sfdx plugins:install sfdx-git-delta | sf plugins install sfdx-git-delta | ||||||||||||||||||||||
61 | Unstall a plugin | sfdx plugins:uninstall sfdx-git-delta | sf plugins uninstall plugin-name | |||||||||||||||||||||||
62 | ||||||||||||||||||||||||||
63 | ||||||||||||||||||||||||||
64 | Scanner | Install SFDX Scanner | sfdx plugins:install @salesforce/sfdx-scanner | sf plugins install @salesforce/sfdx-scanner | ||||||||||||||||||||||
65 | Run SFDX CLI Scanner to scan the code | sfdx 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 | sf 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 | User | Assign Permission Set to User | sf 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 user | sf org assign permset --name DreamHouse --on-behalf-of user1@my.org --on-behalf-of user2 --on-behalf-of user | ||||||||||||||||||||||||
72 | ||||||||||||||||||||||||||
73 | ||||||||||||||||||||||||||
74 | Most Frequently used | Pull the metadata from the org using package.xml | sf project retrieve start --manifest path/to/package.xml | |||||||||||||||||||||||
75 | Deploy the metadata to the org using package.xml | sf project deploy start --manifest path/to/package.xml | ||||||||||||||||||||||||
76 | Deploy the source files in a directory to an org | sf project deploy start --source-dir path/to/source --target-org my-scratch | ||||||||||||||||||||||||
77 | Deploy all custom objects and Apex classes | sf project deploy start --metadata CustomObject ApexClass | ||||||||||||||||||||||||
78 | Deploy a specific Apex class | sf project deploy start --metadata ApexClass:MyApexClass | ||||||||||||||||||||||||
79 | Deploy the metadata to the org using package.xml and run test local cases | sf 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 cases | sf 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 user | sf org generate password --length 12 --target-org my-scratch | ||||||||||||||||||||||||
82 | Generate a password for the specified users in the default scratch org | sf 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 org | sfdx force source manifest create --from-org [your-org-username-here or alias here] --name=allMetadata --output-dir manifest | sf force source manifest create --from-org greybook+ffbox --name=allMetadata --output-dir manifest | |||||||||||||||||||||||
84 | Install SFDX Scanner | sfdx plugins:install @salesforce/sfdx-scanner | sf plugins install @salesforce/sfdx-scanner | |||||||||||||||||||||||
85 | Run SFDX CLI Scanner to scan the code | sfdx 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 | sf 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 files | sfdx 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 Salesforce | sfdx force:source:deploy -x package/package.xml --postdestructivechanges destructiveChanges/destructiveChanges.xml | sf 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 |