3. Getting started with the Salesforce CLI
Useful Links
● Download & Install - https://developer.salesforce.com/tools/sfdxcli
● Official Documentation & Guides - https://developer.salesforce.com/platform/dx
● Learn more with Trailhead - https://sforce.co/2ItyAOz
● Do not fear the CLI https://www.youtube.com/watch?v=m0JDmCpY-AU
4. CLI Command - force:doc:commands:list
● View capabilities and commands for the CLI
● Command - sfdx force:commands:list
sfdx force:doc:commands:list
=== Commands
force:alias:list # list username aliases for the Salesforce CLI
force:alias:set # set username aliases for the Salesforce CLI
force:apex:class:create # create an Apex class
force:apex:execute # execute anonymous Apex code
force:apex:log:get # fetch a debug log
force:apex:log:list # list debug logs
force:apex:log:tail # start debug logging and display logs
force:apex:test:report # display test results
force:apex:test:run # invoke Apex tests
force:apex:trigger:create # create an Apex trigger
force:auth:jwt:grant # authorize an org using the JWT flow
force:auth:logout # log out from authorized orgs
…..
5. CLI Command - force:auth
● Connect any Org with the Salesforce CLI
● Command - sfdx force:auth:web:login
Flags:
-i, --clientid CLIENTID OAuth client ID (sometimes called the consumer key)
-r, --instanceurl INSTANCEURL the login URL of the instance the org lives on
-a, --setalias SETALIAS set an alias for the authenticated org
-d, --setdefaultdevhubusername set the authenticated org as the default dev hub org for scratch org creation
-s, --setdefaultusername set the authenticated org as the default username that all commands run against
--json format output as json
--loglevel LOGLEVEL logging level for this command invocation (error*,trace,debug,info,warn,fatal)
To log in to a sandbox, set --instanceurl to https://test.salesforce.com.
Examples:
$ sfdx force:auth:web:login -a TestOrg1
$ sfdx force:auth:web:login -i <OAuth client id>
$ sfdx force:auth:web:login -r https://test.salesforce.com
6. CLI Command - force:org & force:alias
● Manage connected orgs and alias
● Command - sfdx force:org:list
● Command - sfdx force:alias
Fmanage your Salesforce DX orgs
sfdx force:org commands: (get help with sfdx help force:org:COMMAND)
force:org:create create a scratch org
force:org:delete mark a scratch org for deletion
force:org:display get org description
force:org:list list all orgs you’ve created or authenticated to
force:org:open open an org in your browser
force:org:shape:create create a snapshot of org edition, features, and licenses
force:org:shape:delete delete all org shapes for a target org
force:org:shape:list list all org shapes you’ve created
sfdx force:alias commands: (get help with sfdx help force:alias:COMMAND)
force:alias:list list username aliases for the Salesforce CLI
force:alias:set set username aliases for the Salesforce CLI