SFDX Cli Reference PDF
SFDX Cli Reference PDF
Reference
Salesforce, Spring ’19
@salesforcedocs
Last updated: April 23, 2019
© Copyright 2000–2019 salesforce.com, inc. All rights reserved. Salesforce is a registered trademark of salesforce.com, inc.,
as are other names and marks. Other marks appearing herein may be trademarks of their respective owners.
CONTENTS
The command reference contains information about the Salesforce CLI commands and their parameters. This version of the command
reference includes details about version 45.12.0 of the salesforcedx CLI plug-in, for version 7.3.0 of Salesforce CLI.
For information about installing Salesforce CLI, see the Salesforce DX Setup Guide.
For information about Salesforce CLI changes, see the Salesforce CLI Release Notes.
force Namespace
Use commands in the force namespace to develop on the Salesforce Platform.
Help for Salesforce CLI Commands
The -h | --help parameter shows details about Salesforce CLI topics and their commands.
CLI Deprecation Policy
Salesforce deprecates CLI commands and parameters when, for example, the underlying API changes.
force Namespace
Use commands in the force namespace to develop on the Salesforce Platform.
alias Commands
Use the alias commands to manage username aliases.
apex Commands
Use the apex commands to create Apex classes, execute anonymous blocks, view your logs, run Apex tests, and view Apex test
results.
auth Commands
Use the auth commands to authorize a Salesforce org for use with the Salesforce CLI.
config Commands
Use the config commands to view and set your Salesforce CLI configuration values. Set your default Dev Hub and scratch org, and
your default instance URL, either globally or at the project level.
data Commands
Use the data commands to manipulate records in your org. Commands are available to help you work with various APIs. Import CSV
files with the Bulk API. Export and import data that includes master-detail relationships with the SObject Tree Save API. Perform
simple CRUD operations on individual records with the REST API.
doc Commands
Use the doc commands to display descriptions and help for commands in the force namespace.
lightning Commands
Use the lightning commands to create Aura components and Lightning web components and to test Aura components. As of API
version 45.0, you can build Lightning components using two programming models: Lightning Web Components, and the original
model, Aura Components. Lightning web components and Aura components can coexist and interoperate on a page.
1
Salesforce CLI Command Reference alias Commands
limits Commands
Use the limits commands to view your org’s limits and how close you are to reaching them.
mdapi Commands
Use the mdapi commands to retrieve and deploy Metadata API–formatted files that represent components in an org, or to convert
Metadata API–formatted metadata into the source format used in Salesforce DX projects.
org Commands
Use the org commands to manage the orgs you use with Salesforce CLI. Create and delete scratch orgs, list your created and authorized
orgs, and open orgs in your browser.
package Commands
Use the package commands to develop and install packages.
package1 Commands
Use the package1 commands to create and view first-generation package versions in your Dev Hub org.
project Commands
Use the project commands to set up a Salesforce DX project.
schema Commands
Use the schema commands to view information about the standard and custom objects in your org.
source Commands
Use the source commands to push and pull source to and from your scratch orgs, to deploy and retrieve source to and from
non-source-tracked orgs, to see synchronization changes between your project and scratch orgs, and to convert your source to the
metadata format for Metadata API deployments.
user Commands
Use the user commands to perform user-related admin tasks.
visualforce Commands
Use the visualforce commands to create Visualforce pages and components.
alias Commands
Use the alias commands to manage username aliases.
alias:list
Lists the aliases that the Salesforce CLI can use for various commands and tasks.
alias:set
Sets an alias that the Salesforce CLI can use for various commands and tasks.
alias:list
Lists the aliases that the Salesforce CLI can use for various commands and tasks.
Command Syntax
sfdx force:alias:list
[--json]
[--loglevel LOGLEVEL]
2
Salesforce CLI Command Reference alias Commands
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
alias:set
Sets an alias that the Salesforce CLI can use for various commands and tasks.
Command Syntax
sfdx force:alias:set
[--json]
[--loglevel LOGLEVEL]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
3
Salesforce CLI Command Reference apex Commands
apex Commands
Use the apex commands to create Apex classes, execute anonymous blocks, view your logs, run Apex tests, and view Apex test results.
apex:class:create
Creates an Apex class in the specified directory or the current working directory. If you don’t explicitly set the API version, it defaults
to the current API version. The .cls file and associated metadata file are created.
apex:execute
Executes one or more lines of anonymous Apex code, or executes the code in a local file.
apex:log:get
Fetches the last debug log.
apex:log:list
Displays a list of debug log IDs, along with general information about the logs.
apex:log:tail
Activates debug logging and displays logs in the terminal. You can also pipe the logs to a file.
apex:test:report
Displays the test results for a specific test run.
apex:test:run
Runs Apex tests.
apex:trigger:create
Creates an Apex trigger in the specified directory or the current working directory. If you don’t explicitly set the API version, it defaults
to the current API version. The .trigger file and associated metadata file are created.
apex:class:create
Creates an Apex class in the specified directory or the current working directory. If you don’t explicitly set the API version, it defaults to
the current API version. The .cls file and associated metadata file are created.
Command Syntax
sfdx force:apex:class:create
[--json]
4
Salesforce CLI Command Reference apex Commands
[--loglevel LOGLEVEL]
-n CLASSNAME
[-t TEMPLATE]
[-d OUTPUTDIR]
[-a APIVERSION]
Parameters
--json
Optional
Formats output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-n | --classname CLASSNAME
Required
The name of the new Apex class. The name can be up to 40 characters and must start with a letter.
Type: string
-t | --template TEMPLATE
Optional
The template to use to create the file. Supplied parameter values or default values are filled into a copy of the template.
Type: string
Permissible values are: DefaultApexClass, ApexException, ApexUnitTest, InboundEmailService
Default value: DefaultApexClass
-d | --outputdir OUTPUTDIR
Optional
The directory to store the newly created files. The location can be an absolute path or relative to the current working directory. The
default is the current directory.
Type: string
-a | --apiversion APIVERSION
Optional
The API version of the created source.
Type: string
Permissible values are: 45.0, 44.0
Default value: 45.0
5
Salesforce CLI Command Reference apex Commands
apex:execute
Executes one or more lines of anonymous Apex code, or executes the code in a local file.
Command Syntax
sfdx force:apex:execute
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-f APEXCODEFILE]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-f | --apexcodefile APEXCODEFILE
Optional
Path to a local file that contains Apex code.
Type: filepath
6
Salesforce CLI Command Reference apex Commands
$ sfdx force:apex:execute
>> Start typing Apex code. Press the Enter key after each line,
apex:log:get
Fetches the last debug log.
Command Syntax
sfdx force:apex:log:get
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-c]
[-i LOGID]
[-n NUMBER]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
7
Salesforce CLI Command Reference apex Commands
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-c | --color
Optional
Applies default colors to noteworthy log lines.
Type: boolean
-i | --logid LOGID
Optional
ID of the log to display.
Type: id
-n | --number NUMBER
Optional
Number of most recent logs to display.
Type: number
$ sfdx force:apex:log:get -n 2 -c
apex:log:list
Displays a list of debug log IDs, along with general information about the logs.
Command Syntax
sfdx force:apex:log:list
[--json]
8
Salesforce CLI Command Reference apex Commands
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
apex:log:tail
Activates debug logging and displays logs in the terminal. You can also pipe the logs to a file.
Command Syntax
sfdx force:apex:log:tail
[--json]
[--loglevel LOGLEVEL]
9
Salesforce CLI Command Reference apex Commands
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-c]
[-d DEBUGLEVEL]
[-s]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-c | --color
Optional
Applies default colors to noteworthy log lines.
Type: boolean
-d | --debuglevel DEBUGLEVEL
Optional
Debug level to set on the DEVELOPER_LOG trace flag for your user.
Type: string
-s | --skiptraceflag
Optional
Skips trace flag setup. Assumes that a trace flag and debug level are fully set up.
Type: boolean
10
Salesforce CLI Command Reference apex Commands
$ sfdx force:apex:log:tail -c -s
apex:test:report
Displays the test results for a specific test run.
Command Syntax
sfdx force:apex:test:report
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
-i TESTRUNID
[-c]
[-d OUTPUTDIR]
[-w WAIT]
[--verbose]
[-r RESULTFORMAT]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
11
Salesforce CLI Command Reference apex Commands
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-i | --testrunid TESTRUNID
Required
The ID of test run.
Type: id
-c | --codecoverage
Optional
Retrieves code coverage results.
Type: boolean
-d | --outputdir OUTPUTDIR
Optional
Directory to store test run files.
Type: directory
-w | --wait WAIT
Optional
Sets the streaming client socket timeout, in minutes. If the streaming client socket has no contact from the server for a number of
minutes, the client exits. Specify a longer wait time if timeouts occur frequently.
Type: minutes
Default value: 6
--verbose
Optional
Displays Apex test processing details. If JSON format is specified, processing details aren’t displayed.
Type: boolean
-r | --resultformat RESULTFORMAT
Optional
Format to use when displaying results. If you also specify the --json flag, --json overrides this parameter.
12
Salesforce CLI Command Reference apex Commands
Type: string
Permissible values are: human, tap, junit, json
Default value: human
apex:test:run
Runs Apex tests.
Command Syntax
sfdx force:apex:test:run
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-n CLASSNAMES]
[-s SUITENAMES]
[-t TESTS]
[-c]
[-d OUTPUTDIR]
[-l TESTLEVEL]
[-w WAIT]
[-y]
[--verbose]
[-r RESULTFORMAT]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
13
Salesforce CLI Command Reference apex Commands
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-n | --classnames CLASSNAMES
Optional
Comma-separated list of Apex test class names to run. You can specify only one of classnames, suitenames, or tests.
Type: array
-s | --suitenames SUITENAMES
Optional
Comma-separated list of Apex test suite names to run. You can only specify one of classnames, suitenames, or tests.
Type: array
-t | --tests TESTS
Optional
Comma-separated list of Apex test class names or IDs and test methods, if applicable, to run. You can only specify one of classnames,
suitenames, or tests.
Type: array
-c | --codecoverage
Optional
Retrieves code coverage results.
Type: boolean
-d | --outputdir OUTPUTDIR
Optional
Directory to store test run files.
Type: directory
-l | --testlevel TESTLEVEL
Optional
Specifies which tests to run, using one of these TestLevel enum values:
RunSpecifiedTests—Only the tests that you specify are run.
14
Salesforce CLI Command Reference apex Commands
RunLocalTests—All tests in your org are run, except the ones that originate from installed managed packages.
RunAllTestsInOrg—All tests are in your org and in installed managed packages are run.
Type: string
Permissible values are: RunLocalTests, RunAllTestsInOrg, RunSpecifiedTests
-w | --wait WAIT
Optional
Sets the streaming client socket timeout, in minutes. If the streaming client socket has no contact from the server for a number of
minutes, the client exits. Specify a longer wait time if timeouts occur frequently.
Type: minutes
-y | --synchronous
Optional
Runs test methods from a single Apex class synchronously. If you don't specify this flag, tests are run asynchronously.
Type: boolean
--verbose
Optional
Displays Apex test processing details. If JSON format is specified, processing details aren’t displayed.
Type: boolean
-r | --resultformat RESULTFORMAT
Optional
Format to use when displaying results. If you also specify the --json flag, --json overrides this parameter.
Type: string
Permissible values are: human, tap, junit, json
$ sfdx force:apex:test:run -t
MyClassTest.testCoolFeature,MyClassTest.testAwesomeFeature,AnotherClassTest,namespace.TheirClassTest.testThis
-r human
15
Salesforce CLI Command Reference apex Commands
apex:trigger:create
Creates an Apex trigger in the specified directory or the current working directory. If you don’t explicitly set the API version, it defaults
to the current API version. The .trigger file and associated metadata file are created.
Command Syntax
sfdx force:apex:trigger:create
[--json]
[--loglevel LOGLEVEL]
-n TRIGGERNAME
[-t TEMPLATE]
[-d OUTPUTDIR]
[-a APIVERSION]
[-s SOBJECT]
[-e TRIGGEREVENTS]
Parameters
--json
Optional
Formats output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-n | --triggername TRIGGERNAME
Required
The name of the new Apex trigger. The name can be up to 40 characters and must start with a letter.
Type: string
-t | --template TEMPLATE
Optional
The template to use to create the file. Supplied parameter values or default values are filled into a copy of the template.
Type: string
Permissible values are: ApexTrigger
Default value: ApexTrigger
-d | --outputdir OUTPUTDIR
Optional
16
Salesforce CLI Command Reference auth Commands
The directory to store the newly created files. The location can be an absolute path or relative to the current working directory. The
default is the current directory.
Type: string
-a | --apiversion APIVERSION
Optional
The API version of the created source.
Type: string
Permissible values are: 45.0, 44.0
Default value: 45.0
-s | --sobject SOBJECT
Optional
The sObject to create an Apex trigger on.
Type: string
Default value: SOBJECT
-e | --triggerevents TRIGGEREVENTS
Optional
The events that cause the trigger to fire.
Type: array
Default value: before insert
auth Commands
Use the auth commands to authorize a Salesforce org for use with the Salesforce CLI.
auth:jwt:grant
Authorizes a Salesforce org using the JWT flow.
auth:list
Lists the usernames you’ve authorized. Unlike org:list, this command doesn’t check whether orgs are still valid.
auth:logout
Logs you out from one or all of your authorized Salesforce orgs.
auth:sfdxurl:store
Authorizes a Salesforce org using an SFDX auth URL.
auth:web:login
Authorizes a Salesforce org by opening a browser so you can log in through salesforce.com.
auth:jwt:grant
Authorizes a Salesforce org using the JWT flow.
17
Salesforce CLI Command Reference auth Commands
Command Syntax
sfdx force:auth:jwt:grant
[--json]
[--loglevel LOGLEVEL]
-u USERNAME
-f JWTKEYFILE
-i CLIENTID
[-r INSTANCEURL]
[-d]
[-s]
[-a SETALIAS]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --username USERNAME
Required
The authentication username.
Type: string
-f | --jwtkeyfile JWTKEYFILE
Required
Path to a file containing the private key.
Type: filepath
-i | --clientid CLIENTID
Required
The OAuth client ID (sometimes referred to as the consumer key).
Type: string
-r | --instanceurl INSTANCEURL
Optional
The login URL of the Salesforce instance that the org lives on.
18
Salesforce CLI Command Reference auth Commands
Type: url
-d | --setdefaultdevhubusername
Optional
Sets the authenticated org as the default Dev Hub org for scratch org creation.
Type: boolean
-s | --setdefaultusername
Optional
Sets the authenticated org as the default username that all commands run against.
Type: boolean
-a | --setalias SETALIAS
Optional
Sets an alias for the authenticated org.
Type: string
$ sfdx force:auth:jwt:grant -u [email protected] -f <path to jwt key file> -i <OAuth client id>
-s -a MyDefaultOrg
auth:list
Lists the usernames you’ve authorized. Unlike org:list, this command doesn’t check whether orgs are still valid.
Command Syntax
sfdx force:auth:list
[--json]
[--loglevel LOGLEVEL]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
19
Salesforce CLI Command Reference auth Commands
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
auth:logout
Logs you out from one or all of your authorized Salesforce orgs.
Command Syntax
sfdx force:auth:logout
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-a]
[-p]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
20
Salesforce CLI Command Reference auth Commands
Override the API version used for API requests made by this command.
Type: string
-a | --all
Optional
Includes all authenticated orgs: for example, Dev Hubs, sandboxes, DE orgs, and expired, deleted, and unknown-status scratch orgs.
Type: boolean
-p | --noprompt
Optional
Do not prompt for confirmation.
Type: boolean
$ sfdx force:auth:logout -a
$ sfdx force:auth:logout -p
auth:sfdxurl:store
Authorizes a Salesforce org using an SFDX auth URL.
Command Syntax
sfdx force:auth:sfdxurl:store
[--json]
[--loglevel LOGLEVEL]
-f SFDXURLFILE
[-d]
[-s]
[-a SETALIAS]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
21
Salesforce CLI Command Reference auth Commands
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-f | --sfdxurlfile SFDXURLFILE
Required
Path to a file containing the SFDX URL.
Type: filepath
-d | --setdefaultdevhubusername
Optional
Sets the authenticated org as the default Dev Hub org for scratch org creation.
Type: boolean
-s | --setdefaultusername
Optional
Sets the authenticated org as the default username that all commands run against.
Type: boolean
-a | --setalias SETALIAS
Optional
Sets an alias for the authenticated org.
Type: string
auth:web:login
Authorizes a Salesforce org by opening a browser so you can log in through salesforce.com.
Command Syntax
sfdx force:auth:web:login
[--json]
[--loglevel LOGLEVEL]
[-i CLIENTID]
22
Salesforce CLI Command Reference auth Commands
[-r INSTANCEURL]
[-d]
[-s]
[-a SETALIAS]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-i | --clientid CLIENTID
Optional
The OAuth client ID (sometimes referred to as the consumer key).
Type: string
-r | --instanceurl INSTANCEURL
Optional
The login URL of the Salesforce instance that the org lives on.
Type: url
-d | --setdefaultdevhubusername
Optional
Sets the authenticated org as the default Dev Hub org for scratch org creation.
Type: boolean
-s | --setdefaultusername
Optional
Sets the authenticated org as the default username that all commands run against.
Type: boolean
-a | --setalias SETALIAS
Optional
Sets an alias for the authenticated org.
Type: string
23
Salesforce CLI Command Reference config Commands
Examples:
$ sfdx force:auth:web:login -a TestOrg1
config Commands
Use the config commands to view and set your Salesforce CLI configuration values. Set your default Dev Hub and scratch org, and your
default instance URL, either globally or at the project level.
config:get
Gets the Salesforce CLI configuration values for your default scratch org, your default Dev Hub org, your default instance URL, or any
combination of the three.
config:list
Lists the configuration variables for the Salesforce CLI.
config:set
Sets the local and global configuration variables for the Salesforce CLI.
config:get
Gets the Salesforce CLI configuration values for your default scratch org, your default Dev Hub org, your default instance URL, or any
combination of the three.
Command Syntax
sfdx force:config:get
[--json]
[--loglevel LOGLEVEL]
[--verbose]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
24
Salesforce CLI Command Reference config Commands
--verbose
Optional
Emit additional command output to stdout.
Type: boolean
config:list
Lists the configuration variables for the Salesforce CLI.
Command Syntax
sfdx force:config:list
[--json]
[--loglevel LOGLEVEL]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
25
Salesforce CLI Command Reference data Commands
config:set
Sets the local and global configuration variables for the Salesforce CLI.
Command Syntax
sfdx force:config:set
[--json]
[--loglevel LOGLEVEL]
[-g]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-g | --global
Optional
Sets the configuration variables globally, so they can be used from any directory.
Type: boolean
data Commands
Use the data commands to manipulate records in your org. Commands are available to help you work with various APIs. Import CSV
files with the Bulk API. Export and import data that includes master-detail relationships with the SObject Tree Save API. Perform simple
CRUD operations on individual records with the REST API.
26
Salesforce CLI Command Reference data Commands
data:bulk:delete
Deletes a batch of records listed in a CSV file.
data:bulk:status
Polls the Bulk API for job status or batch status.
data:bulk:upsert
Creates a job and one or more batches for inserting new rows and updating existing rows by accessing the Bulk API.
data:record:create
Creates and inserts a record.
data:record:delete
Deletes a single record.
data:record:get
Displays a single record.
data:record:update
Updates a single record.
data:soql:query
Executes a SOQL query.
data:tree:export
Exports data from an org into sObject tree format for force:data:tree:import consumption.
data:tree:import
Imports data into an org using the SObject Tree Save API. This data can include master-detail relationships.
data:bulk:delete
Deletes a batch of records listed in a CSV file.
Command Syntax
sfdx force:data:bulk:delete
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
-s SOBJECTTYPE
-f CSVFILE
[-w WAIT]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
27
Salesforce CLI Command Reference data Commands
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-s | --sobjecttype SOBJECTTYPE
Required
The sObject type of the records you’re deleting.
Type: string
-f | --csvfile CSVFILE
Required
The path to the CSV file that contains the IDs of the records to delete.
Type: filepath
-w | --wait WAIT
Optional
The number of minutes to wait for the command to complete before displaying the results.
Type: minutes
data:bulk:status
Polls the Bulk API for job status or batch status.
28
Salesforce CLI Command Reference data Commands
Command Syntax
sfdx force:data:bulk:status
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
-i JOBID
[-b BATCHID]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-i | --jobid JOBID
Required
The ID of the job you want to view or of the job whose batch you want to view.
Type: id
-b | --batchid BATCHID
Optional
The ID of the batch whose status you want to view.
Type: id
29
Salesforce CLI Command Reference data Commands
data:bulk:upsert
Creates a job and one or more batches for inserting new rows and updating existing rows by accessing the Bulk API.
Command Syntax
sfdx force:data:bulk:upsert
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
-s SOBJECTTYPE
-f CSVFILE
-i EXTERNALID
[-w WAIT]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
30
Salesforce CLI Command Reference data Commands
Type: string
-s | --sobjecttype SOBJECTTYPE
Required
The sObject type of the records you want to upsert.
Type: string
-f | --csvfile CSVFILE
Required
The path to the CSV file that defines the records to upsert.
Type: filepath
-i | --externalid EXTERNALID
Required
The column name of the external ID.
Type: string
-w | --wait WAIT
Optional
The number of minutes to wait for the command to complete before displaying the results.
Type: minutes
data:record:create
Creates and inserts a record.
Command Syntax
sfdx force:data:record:create
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
-s SOBJECTTYPE
31
Salesforce CLI Command Reference data Commands
-v VALUES
[-t]
[--perflog]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-s | --sobjecttype SOBJECTTYPE
Required
The sObject type of the record you’re creating.
Type: string
-v | --values VALUES
Required
The <fieldName>=<value> pairs you’re creating.
Type: string
-t | --usetoolingapi
Optional
Create the record using Tooling API.
Type: boolean
--perflog
Optional
Gets data on API performance metrics from the server. The data is stored in $HOME/.sfdx/apiPerformanceLog.json
Type: boolean
32
Salesforce CLI Command Reference data Commands
data:record:delete
Deletes a single record.
Command Syntax
sfdx force:data:record:delete
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
-s SOBJECTTYPE
[-i SOBJECTID]
[-w WHERE]
[-t]
[--perflog]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
33
Salesforce CLI Command Reference data Commands
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-s | --sobjecttype SOBJECTTYPE
Required
The sObject type of the record you’re deleting.
Type: string
-i | --sobjectid SOBJECTID
Optional
The ID of the record you’re deleting.
Type: id
-w | --where WHERE
Optional
A list of <fieldName>=<value> pairs to search for.
Type: string
-t | --usetoolingapi
Optional
Delete the record using Tooling API.
Type: boolean
--perflog
Optional
Gets data on API performance metrics from the server. The data is stored in $HOME/.sfdx/apiPerformanceLog.json
Type: boolean
34
Salesforce CLI Command Reference data Commands
Examples:
$ sfdx force:data:record:delete -s Account -i 001D000000Kv3dl
data:record:get
Displays a single record.
Command Syntax
sfdx force:data:record:get
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
-s SOBJECTTYPE
[-i SOBJECTID]
[-w WHERE]
[-t]
[--perflog]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
35
Salesforce CLI Command Reference data Commands
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-s | --sobjecttype SOBJECTTYPE
Required
The sObject type of the record you’re retrieving.
Type: string
-i | --sobjectid SOBJECTID
Optional
The ID of the record you’re retrieving.
Type: id
-w | --where WHERE
Optional
A list of <fieldName>=<value> pairs to search for.
Type: string
-t | --usetoolingapi
Optional
Retrieve the record using Tooling API.
Type: boolean
--perflog
Optional
Gets data on API performance metrics from the server. The data is stored in $HOME/.sfdx/apiPerformanceLog.json
Type: boolean
36
Salesforce CLI Command Reference data Commands
Examples:
$ sfdx force:data:record:get -s Account -i 001D000000Kv3dl
data:record:update
Updates a single record.
Command Syntax
sfdx force:data:record:update
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
-s SOBJECTTYPE
[-i SOBJECTID]
[-w WHERE]
-v VALUES
[-t]
[--perflog]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
37
Salesforce CLI Command Reference data Commands
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-s | --sobjecttype SOBJECTTYPE
Required
The sObject type of the record you’re updating.
Type: string
-i | --sobjectid SOBJECTID
Optional
The ID of the record you’re updating.
Type: id
-w | --where WHERE
Optional
A list of <fieldName>=<value> pairs to search for.
Type: string
-v | --values VALUES
Required
The <fieldName>=<value> pairs you’re updating.
Type: string
-t | --usetoolingapi
Optional
Update the record using Tooling API.
Type: boolean
--perflog
Optional
Gets data on API performance metrics from the server. The data is stored in $HOME/.sfdx/apiPerformanceLog.json
Type: boolean
38
Salesforce CLI Command Reference data Commands
Examples:
$ sfdx force:data:record:update -s Account -i 001D000000Kv3dl -v "Name=NewAcme"
data:soql:query
Executes a SOQL query.
Command Syntax
sfdx force:data:soql:query
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
-q QUERY
[-t]
[-r RESULTFORMAT]
[--perflog]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
39
Salesforce CLI Command Reference data Commands
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-q | --query QUERY
Required
SOQL query to execute.
Type: string
-t | --usetoolingapi
Optional
Execute the query using Tooling API.
Type: boolean
-r | --resultformat RESULTFORMAT
Optional
Format to use when displaying results. If you also specify the --json flag, --json overrides this parameter.
Type: string
Permissible values are: human, csv, json
Default value: human
--perflog
Optional
Gets data on API performance metrics from the server. The data is stored in $HOME/.sfdx/apiPerformanceLog.json
Type: boolean
data:tree:export
Exports data from an org into sObject tree format for force:data:tree:import consumption.
40
Salesforce CLI Command Reference data Commands
Command Syntax
sfdx force:data:tree:export
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
-q QUERY
[-p]
[-x PREFIX]
[-d OUTPUTDIR]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-q | --query QUERY
Required
A SOQL query statement or the path of a file containing a SOQL query statement to retrieve the records to export.
Type: string
-p | --plan
Optional
Generates multiple sObject tree files and a plan definition file for aggregated import.
Type: boolean
41
Salesforce CLI Command Reference data Commands
-x | --prefix PREFIX
Optional
Prefix of generated files.
Type: string
-d | --outputdir OUTPUTDIR
Optional
Directory to store generated files.
Type: directory
data:tree:import
Imports data into an org using the SObject Tree Save API. This data can include master-detail relationships.
Command Syntax
sfdx force:data:tree:import
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-f SOBJECTTREEFILES]
[-p PLAN]
[--confighelp]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
42
Salesforce CLI Command Reference data Commands
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-f | --sobjecttreefiles SOBJECTTREEFILES
Optional
Comma-delimited, ordered paths of JSON files containing a collection of record trees to insert. Either --sobjecttreefiles or --plan is
required.
Type: array
-p | --plan PLAN
Optional
Path to plan to insert multiple data files that have master-detail relationships. Either --sobjecttreefiles or --plan is required.
Type: filepath
--confighelp
Optional
Displays the schema information for the configuration file. If you use this option, all other options, except --json, are ignored.
Type: boolean
43
Salesforce CLI Command Reference doc Commands
To import multiple data files as part of a plan, first run the export command with the -p | --plan flag:
$ sfdx force:data:tree:export -p -q "SELECT Id, Name, (SELECT Id, LastName, FirstName
FROM Contacts) FROM Account"
Then run the import command, supplying a filepath value for the -p | --plan parameter:
$ sfdx force:data:tree:import -p Account-Contact-plan.json -u [email protected]
The SObject Tree API supports requests that contain up to 200 records. For more information, see the REST API Developer Guide:
https://developer.salesforce.com/docs/atlas.en-us.api_rest.meta/api_rest/resources_composite_sobject_tree.htm
doc Commands
Use the doc commands to display descriptions and help for commands in the force namespace.
doc:commands:display
Displays help for commands in the force namespace.
doc:commands:list
Lists the commands in the force namespace.
doc:commands:display
Displays help for commands in the force namespace.
Command Syntax
sfdx force:doc:commands:display
[--json]
[--loglevel LOGLEVEL]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
44
Salesforce CLI Command Reference lightning Commands
To display more details about the commands’ parameters, include the --json flag.
doc:commands:list
Lists the commands in the force namespace.
Command Syntax
sfdx force:doc:commands:list
[--json]
[--loglevel LOGLEVEL]
[-u]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --usage
Optional
Lists docopt usage strings instead of command names and descriptions.
Type: boolean
lightning Commands
Use the lightning commands to create Aura components and Lightning web components and to test Aura components. As of API version
45.0, you can build Lightning components using two programming models: Lightning Web Components, and the original model, Aura
Components. Lightning web components and Aura components can coexist and interoperate on a page.
lightning:app:create
Creates a Lightning app bundle in the specified directory or the current working directory. The bundle consists of multiple files in a
folder with the designated name.
45
Salesforce CLI Command Reference lightning Commands
lightning:component:create
Creates a bundle for an Aura component or a Lightning web component. in the specified directory or the current working directory.
The bundle consists of multiple files in a folder with the designated name.
lightning:event:create
Creates a Lightning event bundle in the specified directory or the current working directory. The bundle consists of multiple files in
a folder with the designated name.
lightning:interface:create
Creates a Lightning interface bundle in the specified directory or the current working directory. The bundle consists of multiple files
in a folder with the designated name.
lightning:lint
Runs a static analysis, or “lint,” tool on your Aura component code. The default rules include recommended best practices and Locker
Service requirements. For details, including how to customize the rules for your org, see the Lightning Aura Components Developer
Guide.
lightning:test:create
Creates a Lightning test in the specified directory or the current working directory. The .resource file and associated metadata file
are created.
lightning:test:install
Installs a Lightning Testing Service (LTS) unmanaged package into your org.
lightning:test:run
Runs Aura component tests. The Lightning Testing Service (LTS) unmanaged package must be installed in your org. For details, see
the LTS documentation.
lightning:app:create
Creates a Lightning app bundle in the specified directory or the current working directory. The bundle consists of multiple files in a folder
with the designated name.
Command Syntax
sfdx force:lightning:app:create
[--json]
[--loglevel LOGLEVEL]
-n APPNAME
[-t TEMPLATE]
[-d OUTPUTDIR]
[-a APIVERSION]
Parameters
--json
Optional
Formats output as JSON.
Type: boolean
46
Salesforce CLI Command Reference lightning Commands
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-n | --appname APPNAME
Required
The Lightning app name. The name can be up to 40 characters and must start with a letter.
Type: string
-t | --template TEMPLATE
Optional
The template to use to create the file. Supplied parameter values or default values are filled into a copy of the template.
Type: string
Permissible values are: DefaultLightningApp
Default value: DefaultLightningApp
-d | --outputdir OUTPUTDIR
Optional
The directory to store the newly created files. The location can be an absolute path or relative to the current working directory. The
default is the current directory.
Type: string
-a | --apiversion APIVERSION
Optional
The API version of the created source.
Type: string
Permissible values are: 45.0, 44.0
Default value: 45.0
lightning:component:create
Creates a bundle for an Aura component or a Lightning web component. in the specified directory or the current working directory. The
bundle consists of multiple files in a folder with the designated name.
Command Syntax
sfdx force:lightning:component:create
[--json]
[--loglevel LOGLEVEL]
-n COMPONENTNAME
47
Salesforce CLI Command Reference lightning Commands
[-t TEMPLATE]
[-d OUTPUTDIR]
[-a APIVERSION]
[--type TYPE]
Parameters
--json
Optional
Formats output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-n | --componentname COMPONENTNAME
Required
The Lightning component name. The name can be up to 40 characters and must start with a letter.
Type: string
-t | --template TEMPLATE
Optional
The template to use to create the file. Supplied parameter values or default values are filled into a copy of the template.
Type: string
Permissible values are: DefaultLightningCmp
Default value: DefaultLightningCmp
-d | --outputdir OUTPUTDIR
Optional
The directory to store the newly created files. The location can be an absolute path or relative to the current working directory. The
default is the current directory.
Type: string
-a | --apiversion APIVERSION
Optional
The API version of the created source.
Type: string
Permissible values are: 45.0, 44.0
Default value: 45.0
--type TYPE
Optional
48
Salesforce CLI Command Reference lightning Commands
lightning:event:create
Creates a Lightning event bundle in the specified directory or the current working directory. The bundle consists of multiple files in a
folder with the designated name.
Command Syntax
sfdx force:lightning:event:create
[--json]
[--loglevel LOGLEVEL]
-n EVENTNAME
[-t TEMPLATE]
[-d OUTPUTDIR]
[-a APIVERSION]
Parameters
--json
Optional
Formats output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-n | --eventname EVENTNAME
Required
The Lightning event name. The name can be up to 40 characters and must start with a letter.
Type: string
-t | --template TEMPLATE
Optional
The template to use to create the file. Supplied parameter values or default values are filled into a copy of the template.
49
Salesforce CLI Command Reference lightning Commands
Type: string
Permissible values are: DefaultLightningEvt
Default value: DefaultLightningEvt
-d | --outputdir OUTPUTDIR
Optional
The directory to store the newly created files. The location can be an absolute path or relative to the current working directory. The
default is the current directory.
Type: string
-a | --apiversion APIVERSION
Optional
The API version of the created source.
Type: string
Permissible values are: 45.0, 44.0
Default value: 45.0
lightning:interface:create
Creates a Lightning interface bundle in the specified directory or the current working directory. The bundle consists of multiple files in
a folder with the designated name.
Command Syntax
sfdx force:lightning:interface:create
[--json]
[--loglevel LOGLEVEL]
-n INTERFACENAME
[-t TEMPLATE]
[-d OUTPUTDIR]
[-a APIVERSION]
Parameters
--json
Optional
Formats output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
50
Salesforce CLI Command Reference lightning Commands
lightning:lint
Runs a static analysis, or “lint,” tool on your Aura component code. The default rules include recommended best practices and Locker
Service requirements. For details, including how to customize the rules for your org, see the Lightning Aura Components Developer
Guide.
Command Syntax
sfdx force:lightning:lint
[--json]
[--loglevel LOGLEVEL]
[-i IGNORE]
[--files FILES]
[--config CONFIG]
[--verbose]
51
Salesforce CLI Command Reference lightning Commands
[--exit]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-i | --ignore IGNORE
Optional
A “glob” pattern used to filter folders (and their contents) out of the analysis. For example: --ignore **/foo/**.
Type: string
--files FILES
Optional
A “glob” pattern used to add specific files to the analysis. For example, to only analyse your controller files, use --files **/*Controller.js.
When specified, this value overrides the --ignore flag. The default is all .js files.
Type: string
--config CONFIG
Optional
Path to a custom ESLint configuration file. Only code style rules are used, while the rest are ignored. For example: --config
path/to/.eslintrc.
Type: string
--verbose
Optional
Report both warnings and errors. The default is to report only errors.
Type: boolean
--exit
Optional
Exit with error code 1 if there are lint issues. The default exits without an error code.
Type: boolean
52
Salesforce CLI Command Reference lightning Commands
lightning:test:create
Creates a Lightning test in the specified directory or the current working directory. The .resource file and associated metadata file are
created.
Command Syntax
sfdx force:lightning:test:create
[--json]
[--loglevel LOGLEVEL]
-n TESTNAME
[-t TEMPLATE]
[-d OUTPUTDIR]
Parameters
--json
Optional
Formats output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-n | --testname TESTNAME
Required
The name of the new Lightning test. The name can be up to 40 characters and must start with a letter.
Type: string
-t | --template TEMPLATE
Optional
The template to use to create the file. Supplied parameter values or default values are filled into a copy of the template.
Type: string
Permissible values are: DefaultLightningTest
Default value: DefaultLightningTest
-d | --outputdir OUTPUTDIR
Optional
The directory to store the newly created files. The location can be an absolute path or relative to the current working directory. The
default is the current directory.
53
Salesforce CLI Command Reference lightning Commands
Type: string
lightning:test:install
Installs a Lightning Testing Service (LTS) unmanaged package into your org.
Command Syntax
sfdx force:lightning:test:install
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-w WAIT]
[-r RELEASEVERSION]
[-t PACKAGETYPE]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-w | --wait WAIT
Optional
54
Salesforce CLI Command Reference lightning Commands
lightning:test:run
Runs Aura component tests. The Lightning Testing Service (LTS) unmanaged package must be installed in your org. For details, see the
LTS documentation.
Command Syntax
sfdx force:lightning:test:run
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-a APPNAME]
[-d OUTPUTDIR]
[-f CONFIGFILE]
[-o]
[-t TIMEOUT]
55
Salesforce CLI Command Reference lightning Commands
[-r RESULTFORMAT]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-a | --appname APPNAME
Optional
Name of your Lightning test application. The name is case insensitive, and ".app" is optional, so "Test" and "test.app" are equivalent.
Default value: Test.app
Type: string
-d | --outputdir OUTPUTDIR
Optional
Directory path to store test run artifacts: log files, test results, and so on.
Type: directory
-f | --configfile CONFIGFILE
Optional
Path to a test configuration file to configure WebDriver and other settings. For details, see the LTS documentation.
Type: filepath
-o | --leavebrowseropen
Optional
Leaves browser open after the test finishes so that you can view the test suite results.
Type: boolean
56
Salesforce CLI Command Reference limits Commands
-t | --timeout TIMEOUT
Optional
Time, in milliseconds, to wait for the results element to be present in the DOM, before failing and moving on to the next test.
Type: number
Default value: 60000
-r | --resultformat RESULTFORMAT
Optional
Format to use when displaying results. If you also specify the --json flag, --json overrides this parameter.
Type: string
Permissible values are: human, tap, junit, json
Default value: human
limits Commands
Use the limits commands to view your org’s limits and how close you are to reaching them.
limits:api:display
Displays remaining and maximum calls and events for your org.
limits:api:display
Displays remaining and maximum calls and events for your org.
Command Syntax
sfdx force:limits:api:display
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
Parameters
--json
Optional
57
Salesforce CLI Command Reference mdapi Commands
mdapi Commands
Use the mdapi commands to retrieve and deploy Metadata API–formatted files that represent components in an org, or to convert
Metadata API–formatted metadata into the source format used in Salesforce DX projects.
mdapi:convert
Converts metadata retrieved via Metadata API into the source format used in Salesforce DX projects.
mdapi:deploy
Deploys file representations of components into an org by creating or updating the components they represent. You can deploy
and retrieve up to 10,000 files or 400 MB (39 MB compressed) at one time. The default target username is the admin user for the
default scratch org.
mdapi:deploy:cancel
Cancels an asynchronous metadata deployment.
mdapi:deploy:report
Checks the current status of an asynchronous metadata deployment.
58
Salesforce CLI Command Reference mdapi Commands
mdapi:describemetadata
Displays details about metadata types enabled for your org. Use this information to identify the syntax needed for a <name> element
in package.xml. The most recent API version is the default, or you can specify an older version.
mdapi:listmetadata
Displays properties of metadata components of a specified type. This call is useful when you want to identify individual components
in your manifest file or if you want a high-level view of particular components in your organization. For example, you could use this
target to return a list of names of all Layout components in your org, then use this information in a retrieve operation that returns a
subset of these components.
mdapi:retrieve
Uses Metadata API to retrieve a .zip of XML files that represent metadata from the targeted org. The default target username is the
admin user for the default scratch org. You can retrieve and deploy up to 10,000 files or 400 MB (39 MB compressed) at one time.
mdapi:retrieve:report
Check the status of an asynchronous metadata retrieval.
mdapi:convert
Converts metadata retrieved via Metadata API into the source format used in Salesforce DX projects.
Command Syntax
sfdx force:mdapi:convert
[--json]
[--loglevel LOGLEVEL]
-r ROOTDIR
[-d OUTPUTDIR]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-r | --rootdir ROOTDIR
Required
The root directory that contains the metadata you retrieved using Metadata API.
Type: directory
59
Salesforce CLI Command Reference mdapi Commands
-d | --outputdir OUTPUTDIR
Optional
The directory to store your files in after they’re converted to the source format. Can be an absolute or relative path.
Type: directory
mdapi:deploy
Deploys file representations of components into an org by creating or updating the components they represent. You can deploy and
retrieve up to 10,000 files or 400 MB (39 MB compressed) at one time. The default target username is the admin user for the default
scratch org.
Command Syntax
sfdx force:mdapi:deploy
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-c]
[-d DEPLOYDIR]
[-w WAIT]
[-i JOBID]
[-l TESTLEVEL]
[-r RUNTESTS]
[-e ROLLBACKONERROR]
[-o]
[-g]
[-q VALIDATEDDEPLOYREQUESTID]
[--verbose]
[-f ZIPFILE]
60
Salesforce CLI Command Reference mdapi Commands
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-c | --checkonly
Optional
Validates the deployed metadata and runs all Apex tests, but prevents the deployment from being saved to the org.
If you change a field type from Master-Detail to Lookup or vice versa, that change isn’t supported when using the --checkonly
parameter to test a deployment (validation). This kind of change isn’t supported for test deployments to avoid the risk of data loss
or corruption. If a change that isn’t supported for test deployments is included in a deployment package, the test deployment fails
and issues an error.
If your deployment package changes a field type from Master-Detail to Lookup or vice versa, you can still validate the changes prior
to deploying to Production by performing a full deployment to another test Sandbox. A full deployment includes a validation of the
changes as part of the deployment process.
Note: A Metadata API deployment that includes Master-Detail relationships deletes all detail records in the Recycle Bin in the following
cases.
1. For a deployment with a new Master-Detail field, soft delete (send to the Recycle Bin) all detail records before proceeding to deploy
the Master-Detail field, or the deployment fails. During the deployment, detail records are permanently deleted from the Recycle
Bin and cannot be recovered.
2. For a deployment that converts a Lookup field relationship to a Master-Detail relationship, detail records must reference a master
record or be soft-deleted (sent to the Recycle Bin) for the deployment to succeed. However, a successful deployment permanently
deletes any detail records in the Recycle Bin.
Type: boolean
-d | --deploydir DEPLOYDIR
Optional
61
Salesforce CLI Command Reference mdapi Commands
The root of the directory tree that contains the files to deploy. The root must contain a valid package.xml file describing the entities
in the directory structure. Required to initiate a deployment if you don’t use --zipfile. If you specify both --zipfile and --deploydir, a
zip file of the contents of the --deploydir directory is written to the location specified by --zipfile.
Type: directory
-w | --wait WAIT
Optional
The number of minutes to wait for the command to complete. The default is –1 (no limit). 0
Type: minutes
-i | --jobid JOBID
The parameter --jobid has been deprecated and will be removed in v42.0 or later. Use instead.
Optional
The job ID (asyncId) of the deployment you want to check. If not specified, the default value is the ID of the most recent metadata
deployment you ran using Salesforce CLI. Use with -w to resume waiting.
Type: id
-l | --testlevel TESTLEVEL
Optional
Specifies which level of deployment tests to run. Valid values are:
NoTestRun—No tests are run. This test level applies only to deployments to development environments, such as sandbox, Developer
Edition, or trial orgs. This test level is the default for development environments.
RunSpecifiedTests—Runs only the tests that you specify in the --runtests option. Code coverage requirements differ from the default
coverage requirements when using this test level. Executed tests must comprise a minimum of 75% code coverage for each class
and trigger in the deployment package. This coverage is computed for each class and trigger individually and is different than the
overall coverage percentage.
RunLocalTests—All tests in your org are run, except the ones that originate from installed managed packages. This test level is the
default for production deployments that include Apex classes or triggers.
RunAllTestsInOrg—All tests in your org are run, including tests of managed packages.
If you don’t specify a test level, the default behavior depends on the contents of your deployment package. For more information,
see “Running Tests in a Deployment” in the Metadata API Developer Guide.
Type: string
Permissible values are: NoTestRun, RunSpecifiedTests, RunLocalTests, RunAllTestsInOrg
-r | --runtests RUNTESTS
Optional
Lists the Apex classes containing the deployment tests to run. Use this parameter when you set --testlevel to RunSpecifiedTests.
Type: array
-e | --rollbackonerror ROLLBACKONERROR
The parameter --rollbackonerror has been deprecated and will be removed in v42.0 or later. Use instead.
Optional
Indicates whether any failure causes a complete rollback of the deploy operation. The default is true. If set to false, the operation
performs actions that don’t have errors and returns errors for the remaining actions. You must set this parameter to true if you are
deploying to a production org.
Type: string
62
Salesforce CLI Command Reference mdapi Commands
63
Salesforce CLI Command Reference mdapi Commands
mdapi:deploy:cancel
Cancels an asynchronous metadata deployment.
Command Syntax
sfdx force:mdapi:deploy:cancel
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-w WAIT]
[-i JOBID]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
64
Salesforce CLI Command Reference mdapi Commands
-w | --wait WAIT
Optional
Number of minutes to wait for the command to complete and display results to the terminal window. If the command continues
to run after the wait period, the CLI returns control of the terminal window to you. The default is 33 minutes.
Type: minutes
Default value: 33
-i | --jobid JOBID
Optional
The job ID (requestId) of the deployment you want to cancel. If not specified, the default value is the ID of the most recent metadata
deployment you ran using Salesforce CLI.
Type: id
If you have multiple deployments in progress and want to cancel a specific one, specify the job ID
$ sfdx force:mdapi:deploy:cancel -i <jobid>
mdapi:deploy:report
Checks the current status of an asynchronous metadata deployment.
Command Syntax
sfdx force:mdapi:deploy:report
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-w WAIT]
[-i JOBID]
[--verbose]
65
Salesforce CLI Command Reference mdapi Commands
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-w | --wait WAIT
Optional
The number of minutes to wait for the command to complete. The default is –1 (no limit). 0
Type: minutes
-i | --jobid JOBID
Optional
The job ID (asyncId) of the deployment you want to check. If not specified, the default value is the ID of the most recent metadata
deployment you ran using Salesforce CLI. Use with -w to resume waiting.
Type: id
--verbose
Optional
Indicates that you want verbose output for deploy results.
Type: boolean
mdapi:describemetadata
Displays details about metadata types enabled for your org. Use this information to identify the syntax needed for a <name> element
in package.xml. The most recent API version is the default, or you can specify an older version.
66
Salesforce CLI Command Reference mdapi Commands
Command Syntax
sfdx force:mdapi:describemetadata
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[-a APIVERSION]
[-f RESULTFILE]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
-a | --apiversion APIVERSION
Optional
The API version to use. The default is the latest API version (45.0).
Type: string
-f | --resultfile RESULTFILE
Optional
The path to the file where the results of the command are stored. Directing the output to a file makes it easier to extract relevant
information for your package.xml manifest file. The default output destination is the console.
Type: filepath
67
Salesforce CLI Command Reference mdapi Commands
Examples:
$ sfdx force:mdapi:describemetadata -a 43.0
mdapi:listmetadata
Displays properties of metadata components of a specified type. This call is useful when you want to identify individual components in
your manifest file or if you want a high-level view of particular components in your organization. For example, you could use this target
to return a list of names of all Layout components in your org, then use this information in a retrieve operation that returns a subset of
these components.
Command Syntax
sfdx force:mdapi:listmetadata
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[-a APIVERSION]
[-f RESULTFILE]
-m METADATATYPE
[--folder FOLDER]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
68
Salesforce CLI Command Reference mdapi Commands
-a | --apiversion APIVERSION
Optional
The API version to use. The default is the latest API version (45.0).
Type: string
-f | --resultfile RESULTFILE
Optional
The path to the file where the results of the command are stored. The default output destination is the console.
Type: filepath
-m | --metadatatype METADATATYPE
Required
The metadata type to be retrieved, such as CustomObject or Report. The metadata type value is case-sensitive.
Type: string
--folder FOLDER
Optional
The folder associated with the component. This parameter is required for components that use folders, such as Dashboard, Document,
EmailTemplate, or Report. The folder name value is case-sensitive.
Type: string
mdapi:retrieve
Uses Metadata API to retrieve a .zip of XML files that represent metadata from the targeted org. The default target username is the admin
user for the default scratch org. You can retrieve and deploy up to 10,000 files or 400 MB (39 MB compressed) at one time.
69
Salesforce CLI Command Reference mdapi Commands
Command Syntax
sfdx force:mdapi:retrieve
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[-a APIVERSION]
[-w WAIT]
-r RETRIEVETARGETDIR
[-k UNPACKAGED]
[--verbose]
[-d SOURCEDIR]
[-p PACKAGENAMES]
[-s]
[-i JOBID]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
-a | --apiversion APIVERSION
Optional
Use to override the default, which is the latest version supported by your CLI plug-in, with the version in your package.xml file.
Type: string
-w | --wait WAIT
Optional
The number of minutes to wait for the command to complete. -1
Type: minutes
70
Salesforce CLI Command Reference mdapi Commands
-r | --retrievetargetdir RETRIEVETARGETDIR
Required
The root of the directory structure where the retrieved .zip or metadata files are put.
Type: directory
-k | --unpackaged UNPACKAGED
Optional
The complete path for the manifest file that specifies the components to retrieve.
Type: filepath
--verbose
Optional
Indicates that you want verbose output from the retrieve operation.
Type: boolean
-d | --sourcedir SOURCEDIR
Optional
The source directory to use instead of the default manifest specified in sfdx-config.json.
Type: directory
-p | --packagenames PACKAGENAMES
Optional
A comma-separated list of package names to retrieve.
Type: array
-s | --singlepackage
Optional
Specifies whether only a single package is being retrieved (true) or more than one package (false).
Type: boolean
-i | --jobid JOBID
The parameter --jobid has been deprecated and will be removed in v42.0 or later. Use instead.
Optional
The job ID (asyncId) of the retrieve you want to check. If not specified, the default value is the ID of the most recent metadata retrieval
you ran using Salesforce CLI. You must specify a --retrievetargetdir. Use with --wait to resume waiting.
Type: id
mdapi:retrieve:report
Check the status of an asynchronous metadata retrieval.
71
Salesforce CLI Command Reference mdapi Commands
Command Syntax
sfdx force:mdapi:retrieve:report
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-w WAIT]
[-r RETRIEVETARGETDIR]
[--verbose]
[-i JOBID]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-w | --wait WAIT
Optional
The number of minutes to wait for the command to complete. -1
Type: minutes
-r | --retrievetargetdir RETRIEVETARGETDIR
Optional
The root of the directory structure where the retrieved .zip or metadata files are put.
Type: directory
72
Salesforce CLI Command Reference org Commands
--verbose
Optional
Indicates that you want verbose output from the retrieve operation.
Type: boolean
-i | --jobid JOBID
Optional
The job ID (asyncId) of the retrieve you want to check. If not specified, the default value is the ID of the most recent metadata retrieval
you ran using Salesforce CLI. You must specify a --retrievetargetdir. Use with --wait to resume waiting.
Type: id
org Commands
Use the org commands to manage the orgs you use with Salesforce CLI. Create and delete scratch orgs, list your created and authorized
orgs, and open orgs in your browser.
org:create
Creates a scratch org using values specified in a configuration file or key=value pairs that you specify on the command line. Values
specified on the command line override values in the configuration file.
org:delete
Marks a scratch org for deletion.
org:display
Gets the description for the current or target org.
org:list
Lists all orgs that the Salesforce CLI has created or authenticated to.
org:open
Opens an org in your browser.
org:shape:create (Pilot)
Creates a snapshot of org edition, features, and licenses to use for scratch org creation, allowing your scratch org to look like another
org for testing.
org:shape:delete (Pilot)
Deletes all org shapes that you’ve created for an org using the Salesforce CLI.
org:shape:list (Pilot)
Lists all org shapes that you’ve created using the Salesforce CLI.
org:snapshot:create (Pilot)
Creates a snapshot of a scratch org.
73
Salesforce CLI Command Reference org Commands
org:snapshot:delete (Pilot)
Deletes a scratch org snapshot.
org:snapshot:get (Pilot)
Retrieves details about a scratch org snapshot.
org:snapshot:list (Pilot)
Lists scratch org snapshots for your Dev Hub.
org:create
Creates a scratch org using values specified in a configuration file or key=value pairs that you specify on the command line. Values
specified on the command line override values in the configuration file.
Command Syntax
sfdx force:org:create
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[--apiversion APIVERSION]
[-f DEFINITIONFILE]
[-n]
[-c]
[-i CLIENTID]
[-s]
[-a SETALIAS]
[-w WAIT]
[-d DURATIONDAYS]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
74
Salesforce CLI Command Reference org Commands
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional
A username or alias for the target Dev Hub org. Overrides the default Dev Hub org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-f | --definitionfile DEFINITIONFILE
Optional
Path to a scratch org definition file. Either --definitionfile or a vararg value for edition (for example, edition=Developer) is required.
Varargs override the values in the scratch org definition file.
Type: filepath
-n | --nonamespace
Optional
Creates the scratch org with no namespace. Useful when using a scratch org to test installations of packages with namespaces.
Type: boolean
-c | --noancestors
Optional
Do not include second-generation package ancestors in the scratch org.
Type: boolean
-i | --clientid CLIENTID
Optional
Connected app consumer key, as configured in your Dev Hub.
Type: string
-s | --setdefaultusername
Optional
Sets the created org as the default username.
Type: boolean
-a | --setalias SETALIAS
Optional
Sets an alias for for the created scratch org.
Type: string
-w | --wait WAIT
Optional
Sets the streaming client socket timeout, in minutes. If the streaming client socket has no contact from the server for a number of
minutes, the client exits. Specify a longer wait time if timeouts occur frequently.
Type: minutes
Default value: 6
75
Salesforce CLI Command Reference org Commands
-d | --durationdays DURATIONDAYS
Optional
Sets the duration of the scratch org, in days. Valid values are from 1-30. The default is 7 days.
Type: number
org:delete
Marks a scratch org for deletion.
Command Syntax
sfdx force:org:delete
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-p]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
76
Salesforce CLI Command Reference org Commands
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional
A username or alias for the target Dev Hub org. Overrides the default Dev Hub org.
Type: string
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-p | --noprompt
Optional
No prompt to confirm deletion.
Type: boolean
org:display
Gets the description for the current or target org.
Command Syntax
sfdx force:org:display
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[--verbose]
Parameters
--json
Optional
77
Salesforce CLI Command Reference org Commands
org:list
Lists all orgs that the Salesforce CLI has created or authenticated to.
Command Syntax
sfdx force:org:list
[--json]
78
Salesforce CLI Command Reference org Commands
[--loglevel LOGLEVEL]
[--verbose]
[--all]
[--clean]
[-p]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
--verbose
Optional
Lists more information about each org.
Type: boolean
--all
Optional
Lists all authenticated orgs, including expired, deleted, and unknown-status scratch orgs.
Type: boolean
--clean
Optional
Remove all local org authorizations for deleted or expired orgs.
Type: boolean
-p | --noprompt
Optional
Do not prompt for confirmation.
Type: boolean
79
Salesforce CLI Command Reference org Commands
org:open
Opens an org in your browser.
Command Syntax
sfdx force:org:open
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-p PATH]
[-r]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
80
Salesforce CLI Command Reference org Commands
-p | --path PATH
Optional
Navigation URL path (not including domain).
Type: string
-r | --urlonly
Optional
Displays a navigation URL, but doesn’t launch your browser.
Type: boolean
org:shape:create (Pilot)
Creates a snapshot of org edition, features, and licenses to use for scratch org creation, allowing your scratch org to look like another
org for testing.
Note: We provide the org:shape:create command to selected customers through an invitation-only pilot program that
requires agreement to specific terms and conditions. Pilot programs are subject to change, and we can’t guarantee acceptance.
The org:shape:create command isn’t generally available unless or until Salesforce announces its general availability in
documentation or in press releases or public statements. We can’t guarantee general availability within any particular time frame
or at all. Make your purchase decisions only on the basis of generally available products and features. You can provide feedback
and suggestions for the org:shape:create command in the W19 Pilot: Org Shape for Scratch Orgs group in the Trailblazer
Community.
Command Syntax
sfdx force:org:shape:create
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
81
Salesforce CLI Command Reference org Commands
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
org:shape:delete (Pilot)
Deletes all org shapes that you’ve created for an org using the Salesforce CLI.
Note: We provide the org:shape:delete command to selected customers through an invitation-only pilot program that
requires agreement to specific terms and conditions. Pilot programs are subject to change, and we can’t guarantee acceptance.
The org:shape:delete command isn’t generally available unless or until Salesforce announces its general availability in
documentation or in press releases or public statements. We can’t guarantee general availability within any particular time frame
or at all. Make your purchase decisions only on the basis of generally available products and features. You can provide feedback
and suggestions for the org:shape:delete command in the W19 Pilot: Org Shape for Scratch Orgs group in the Trailblazer
Community.
Command Syntax
sfdx force:org:shape:delete
[--json]
[--loglevel LOGLEVEL]
82
Salesforce CLI Command Reference org Commands
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-p]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-p | --noprompt
Optional
Do not prompt for confirmation.
Type: boolean
org:shape:list (Pilot)
Lists all org shapes that you’ve created using the Salesforce CLI.
83
Salesforce CLI Command Reference org Commands
Note: We provide the org:shape:list command to selected customers through an invitation-only pilot program that
requires agreement to specific terms and conditions. Pilot programs are subject to change, and we can’t guarantee acceptance.
The org:shape:list command isn’t generally available unless or until Salesforce announces its general availability in
documentation or in press releases or public statements. We can’t guarantee general availability within any particular time frame
or at all. Make your purchase decisions only on the basis of generally available products and features. You can provide feedback
and suggestions for the org:shape:list command in the W19 Pilot: Org Shape for Scratch Orgs group in the Trailblazer
Community.
Command Syntax
sfdx force:org:shape:list
[--json]
[--loglevel LOGLEVEL]
[--verbose]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
--verbose
Optional
Lists more information about each org shape.
Type: boolean
org:snapshot:create (Pilot)
Creates a snapshot of a scratch org.
84
Salesforce CLI Command Reference org Commands
Note: We provide the org:snapshot:create command to selected customers through an invitation-only pilot program
that requires agreement to specific terms and conditions. Pilot programs are subject to change, and we can’t guarantee acceptance.
The org:snapshot:create command isn’t generally available unless or until Salesforce announces its general availability
in documentation or in press releases or public statements. We can’t guarantee general availability within any particular time frame
or at all. Make your purchase decisions only on the basis of generally available products and features. You can provide feedback
and suggestions for the org:snapshot:create command in the W19 Pilot: Scratch Org Snapshots group in the Trailblazer
Community.
Command Syntax
sfdx force:org:snapshot:create
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[--apiversion APIVERSION]
-o SOURCEORG
-n SNAPSHOTNAME
[-d DESCRIPTION]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional
A username or alias for the target Dev Hub org. Overrides the default Dev Hub org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-o | --sourceorg SOURCEORG
Required
The org ID, or a locally authenticated username or alias, of the scratch org to snapshot.
85
Salesforce CLI Command Reference org Commands
Type: string
-n | --snapshotname SNAPSHOTNAME
Required
The unique name of the snapshot. Use this name to create scratch orgs from the snapshot.
Type: string
-d | --description DESCRIPTION
Optional
A description of the snapshot. Use this description to document the contents of the snapshot. We suggest that you include a reference
point, such as a version control system tag or commit ID.
Type: string
org:snapshot:delete (Pilot)
Deletes a scratch org snapshot.
Note: We provide the org:snapshot:delete command to selected customers through an invitation-only pilot program
that requires agreement to specific terms and conditions. Pilot programs are subject to change, and we can’t guarantee acceptance.
The org:snapshot:delete command isn’t generally available unless or until Salesforce announces its general availability
in documentation or in press releases or public statements. We can’t guarantee general availability within any particular time frame
or at all. Make your purchase decisions only on the basis of generally available products and features. You can provide feedback
and suggestions for the org:snapshot:delete command in the W19 Pilot: Scratch Org Snapshots group in the Trailblazer
Community.
Command Syntax
sfdx force:org:snapshot:delete
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[--apiversion APIVERSION]
-s SNAPSHOT
86
Salesforce CLI Command Reference org Commands
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional
A username or alias for the target Dev Hub org. Overrides the default Dev Hub org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-s | --snapshot SNAPSHOT
Required
The name or ID (starts with 0Oo) of the snapshot to delete.
Type: string
org:snapshot:get (Pilot)
Retrieves details about a scratch org snapshot.
Note: We provide the org:snapshot:get command to selected customers through an invitation-only pilot program that
requires agreement to specific terms and conditions. Pilot programs are subject to change, and we can’t guarantee acceptance.
The org:snapshot:get command isn’t generally available unless or until Salesforce announces its general availability in
documentation or in press releases or public statements. We can’t guarantee general availability within any particular time frame
or at all. Make your purchase decisions only on the basis of generally available products and features. You can provide feedback
and suggestions for the org:snapshot:get command in the W19 Pilot: Scratch Org Snapshots group in the Trailblazer
Community.
87
Salesforce CLI Command Reference org Commands
Command Syntax
sfdx force:org:snapshot:get
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[--apiversion APIVERSION]
-s SNAPSHOT
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional
A username or alias for the target Dev Hub org. Overrides the default Dev Hub org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-s | --snapshot SNAPSHOT
Required
The name or ID (starts with 0Oo) of the snapshot to retrieve.
Type: string
88
Salesforce CLI Command Reference org Commands
org:snapshot:list (Pilot)
Lists scratch org snapshots for your Dev Hub.
Note: We provide the org:snapshot:list command to selected customers through an invitation-only pilot program
that requires agreement to specific terms and conditions. Pilot programs are subject to change, and we can’t guarantee acceptance.
The org:snapshot:list command isn’t generally available unless or until Salesforce announces its general availability in
documentation or in press releases or public statements. We can’t guarantee general availability within any particular time frame
or at all. Make your purchase decisions only on the basis of generally available products and features. You can provide feedback
and suggestions for the org:snapshot:list command in the W19 Pilot: Scratch Org Snapshots group in the Trailblazer
Community.
Command Syntax
sfdx force:org:snapshot:list
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[--apiversion APIVERSION]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional
A username or alias for the target Dev Hub org. Overrides the default Dev Hub org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
89
Salesforce CLI Command Reference package Commands
package Commands
Use the package commands to develop and install packages.
package:create
Creates a package.
package:install
Installs a package in the target org.
package:install:report
Retrieves the status of a package installation request.
package:installed:list
Lists all packages installed in the target org.
package:list
Lists all packages in the Dev Hub org.
package:uninstall
Uninstalls a second-generation package from the target org. To uninstall a first-generation package, use the Salesforce user interface.
package:uninstall:report
Retrieves the status of a package uninstall request.
package:update
Updates details about a package. Does not create a package version.
package:version:create
Creates a package version in the Dev Hub org.
package:version:create:list
Lists all requests to create second-generation package versions in the Dev Hub org.
package:version:create:report
Retrieves details about a package version creation request in the Dev Hub org.
package:version:list
Lists all package versions in the Dev Hub org.
package:version:promote
Promotes a package version to released status.
package:version:report
Retrieves details about a package version in the Dev Hub org.
package:version:update
Updates a second-generation package version in the Dev Hub org.
90
Salesforce CLI Command Reference package Commands
package:create
Creates a package.
Command Syntax
sfdx force:package:create
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[--apiversion APIVERSION]
-n NAME
-t PACKAGETYPE
[-d DESCRIPTION]
[-e]
-r PATH
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional
A username or alias for the target Dev Hub org. Overrides the default Dev Hub org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-n | --name NAME
Required
Name of the package to create.
Type: string
91
Salesforce CLI Command Reference package Commands
-t | --packagetype PACKAGETYPE
Required
Package type for the package.
The options for package type are Managed and Unlocked (Managed=DeveloperManagedSubscriberManaged,
Unlocked=DeveloperControlledSubscriberEditable). Managed packages are currently in beta.
These options determine upgrade and editability rules.
Type: string
Permissible values are: Managed, Unlocked
-d | --description DESCRIPTION
Optional
Description of the package.
Type: string
-e | --nonamespace
Optional
Creates the package with no namespace. Available only for unlocked packages. Useful when you’re migrating an existing org to
packages. But, use a namespaced package for new metadata.
Type: boolean
-r | --path PATH
Required
The path to the directory that contains the contents of the package.
Type: directory
Run 'sfdx force:package:list' to list all packages in the Dev Hub org.
package:install
Installs a package in the target org.
Command Syntax
sfdx force:package:install
[--json]
92
Salesforce CLI Command Reference package Commands
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-w WAIT]
[-k INSTALLATIONKEY]
[-b PUBLISHWAIT]
[-r]
[-p PACKAGE]
[-s SECURITYTYPE]
[-t UPGRADETYPE]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-w | --wait WAIT
Optional
Maximum number of minutes to wait for installation status. The default is 0.
Type: minutes
-k | --installationkey INSTALLATIONKEY
Optional
Installation key for installing a key-protected package. The default is null.
Type: string
93
Salesforce CLI Command Reference package Commands
-b | --publishwait PUBLISHWAIT
Optional
Maximum number of minutes to wait for the Subscriber Package Version ID to become available in the target org before canceling
the install request. The default is 0.
Type: minutes
-r | --noprompt
Optional
Allow Remote Site Settings and Content Security Policy websites to send or receive data without confirmation.
Type: boolean
-p | --package PACKAGE
Optional
The ID (starts with 04t) or alias of the package version to install.
Type: string
-s | --securitytype SECURITYTYPE
Optional
Security access type for the installed package.
Type: string
Permissible values are: AllUsers, AdminsOnly
Default value: AllUsers
-t | --upgradetype UPGRADETYPE
Optional
For package upgrades, specifies whether to mark all removed components as deprecated (DeprecateOnly) or to delete removed
components that can be safely deleted and deprecate the others (Mixed).
Type: string
Permissible values are: DeprecateOnly, Mixed
Default value: Mixed
94
Salesforce CLI Command Reference package Commands
package:install:report
Retrieves the status of a package installation request.
Command Syntax
sfdx force:package:install:report
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
-i REQUESTID
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-i | --requestid REQUESTID
Required
The ID of the package install request you want to check.
Type: id
95
Salesforce CLI Command Reference package Commands
package:installed:list
Lists all packages installed in the target org.
Command Syntax
sfdx force:package:installed:list
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
96
Salesforce CLI Command Reference package Commands
package:list
Lists all packages in the Dev Hub org.
Command Syntax
sfdx force:package:list
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[--apiversion APIVERSION]
[--verbose]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional
A username or alias for the target Dev Hub org. Overrides the default Dev Hub org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
--verbose
Optional
Displays extended package details.
97
Salesforce CLI Command Reference package Commands
Type: boolean
package:uninstall
Uninstalls a second-generation package from the target org. To uninstall a first-generation package, use the Salesforce user interface.
Command Syntax
sfdx force:package:uninstall
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-w WAIT]
[-p PACKAGE]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
98
Salesforce CLI Command Reference package Commands
Override the API version used for API requests made by this command.
Type: string
-w | --wait WAIT
Optional
Maximum number of minutes to wait for uninstall status. The default is 0.
Type: minutes
-p | --package PACKAGE
Optional
The ID (starts with 04t) or alias of the package version to uninstall.
Type: string
package:uninstall:report
Retrieves the status of a package uninstall request.
Command Syntax
sfdx force:package:uninstall:report
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
-i REQUESTID
Parameters
--json
Optional
Format output as JSON.
Type: boolean
99
Salesforce CLI Command Reference package Commands
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-i | --requestid REQUESTID
Required
The ID of the package uninstall request you want to check.
Type: id
package:update
Updates details about a package. Does not create a package version.
Command Syntax
sfdx force:package:update
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[--apiversion APIVERSION]
-p PACKAGE
[-n NAME]
[-d DESCRIPTION]
100
Salesforce CLI Command Reference package Commands
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional
A username or alias for the target Dev Hub org. Overrides the default Dev Hub org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-p | --package PACKAGE
Required
The ID (starts with 0Ho) or alias of the package to update.
Type: string
-n | --name NAME
Optional
New name of the package.
Type: string
-d | --description DESCRIPTION
Optional
New description of the package.
Type: string
Run "sfdx force:package:list" to list all packages in the Dev Hub org.
101
Salesforce CLI Command Reference package Commands
package:version:create
Creates a package version in the Dev Hub org.
Command Syntax
sfdx force:package:version:create
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[--apiversion APIVERSION]
[-p PACKAGE]
[-d PATH]
[-f DEFINITIONFILE]
[-b BRANCH]
[-t TAG]
[-k INSTALLATIONKEY]
[-x]
[-w WAIT]
[-a VERSIONNAME]
[-n VERSIONNUMBER]
[-e VERSIONDESCRIPTION]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional
A username or alias for the target Dev Hub org. Overrides the default Dev Hub org.
Type: string
--apiversion APIVERSION
Optional
102
Salesforce CLI Command Reference package Commands
Override the API version used for API requests made by this command.
Type: string
-p | --package PACKAGE
Optional
The ID (starts with 0Ho) or alias of the package to create a version of.
Type: string
-d | --path PATH
Optional
The path to the directory that contains the contents of the package.
Type: directory
-f | --definitionfile DEFINITIONFILE
Optional
The path to a definition file similar to scratch org definition file that contains the list of features and org preferences that the metadata
of the package version depends on.
Type: filepath
-b | --branch BRANCH
Optional
The package version’s branch.
Type: string
-t | --tag TAG
Optional
The package version’s tag.
Type: string
-k | --installationkey INSTALLATIONKEY
Optional
Installation key for creating the key-protected package. Either an --installationkey value or the --installationkeybypass flag is required.
Type: string
-x | --installationkeybypass
Optional
Bypasses the installation key requirement. If you bypass this requirement, anyone can install your package. Either an --installationkey
value or the --installationkeybypass flag is required.
Type: boolean
-w | --wait WAIT
Optional
The number of minutes to wait for the package version to be created.
Type: minutes
-a | --versionname VERSIONNAME
Optional
The name of the package version to be created. Overrides the sfdx-project.json value.
Type: string
103
Salesforce CLI Command Reference package Commands
-n | --versionnumber VERSIONNUMBER
Optional
The version number of the package version to be created. Overrides the sfdx-project.json value.
Type: string
-e | --versiondescription VERSIONDESCRIPTION
Optional
The description of the package version to be created. Overrides the sfdx-project.json value.
Type: string
package:version:create:list
Lists all requests to create second-generation package versions in the Dev Hub org.
Command Syntax
sfdx force:package:version:create:list
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[--apiversion APIVERSION]
[-c CREATEDLASTDAYS]
[-s STATUS]
Parameters
--json
Optional
Format output as JSON.
104
Salesforce CLI Command Reference package Commands
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional
A username or alias for the target Dev Hub org. Overrides the default Dev Hub org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-c | --createdlastdays CREATEDLASTDAYS
Optional
Filters the list based on the specified maximum number of days since the request was created (starting at 00:00:00 of first day to
now; 0 for today).
Type: number
-s | --status STATUS
Optional
Filters the list based on the status of version creation requests.
Type: string
Permissible values are: Queued, InProgress, Success, Error
105
Salesforce CLI Command Reference package Commands
package:version:create:report
Retrieves details about a package version creation request in the Dev Hub org.
Command Syntax
sfdx force:package:version:create:report
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[--apiversion APIVERSION]
-i PACKAGECREATEREQUESTID
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional
A username or alias for the target Dev Hub org. Overrides the default Dev Hub org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-i | --packagecreaterequestid PACKAGECREATEREQUESTID
Required
The ID (starts with 08c) of the package version creation request you want to display.
Type: id
106
Salesforce CLI Command Reference package Commands
Examples:
$ sfdx force:package:version:create:report -i 08c...
package:version:list
Lists all package versions in the Dev Hub org.
Command Syntax
sfdx force:package:version:list
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[--apiversion APIVERSION]
[-c CREATEDLASTDAYS]
[--concise]
[-m MODIFIEDLASTDAYS]
[-p PACKAGES]
[-r]
[-o ORDERBY]
[--verbose]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional
A username or alias for the target Dev Hub org. Overrides the default Dev Hub org.
Type: string
107
Salesforce CLI Command Reference package Commands
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-c | --createdlastdays CREATEDLASTDAYS
Optional
Filters the list based on the specified maximum number of days since the request was created (starting at 00:00:00 of first day to
now; 0 for today).
Type: number
--concise
Optional
Displays limited package version details.
Type: boolean
-m | --modifiedlastdays MODIFIEDLASTDAYS
Optional
Lists the items modified in the specified last number of days, starting at 00:00:00 of first day to now. Use 0 for today.
Type: number
-p | --packages PACKAGES
Optional
Filters results on the specified comma-delimited packages (aliases or 0Ho IDs).
Type: array
-r | --released
Optional
Displays released versions only (IsReleased=true).
Type: boolean
-o | --orderby ORDERBY
Optional
Orders the list by the specified package version fields.
Type: array
--verbose
Optional
Displays extended package version details.
Type: boolean
108
Salesforce CLI Command Reference package Commands
Examples:
$ sfdx force:package:version:list --verbose --createdlastdays 3 --released --orderby
PatchVersion
package:version:promote
Promotes a package version to released status.
Command Syntax
sfdx force:package:version:promote
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[--apiversion APIVERSION]
-p PACKAGE
[-n]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional
A username or alias for the target Dev Hub org. Overrides the default Dev Hub org.
109
Salesforce CLI Command Reference package Commands
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-p | --package PACKAGE
Required
The ID (starts with 04t) or alias of the package version to promote.
Type: string
-n | --noprompt
Optional
Do not prompt to confirm setting the package version as released.
Type: boolean
package:version:report
Retrieves details about a package version in the Dev Hub org.
Command Syntax
sfdx force:package:version:report
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[--apiversion APIVERSION]
-p PACKAGE
[--verbose]
Parameters
--json
Optional
Format output as JSON.
110
Salesforce CLI Command Reference package Commands
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional
A username or alias for the target Dev Hub org. Overrides the default Dev Hub org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-p | --package PACKAGE
Required
The ID (starts with 04t) or alias of the package to retrieve details for.
Type: string
--verbose
Optional
Displays extended package version details.
Type: boolean
package:version:update
Updates a second-generation package version in the Dev Hub org.
Command Syntax
sfdx force:package:version:update
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
111
Salesforce CLI Command Reference package Commands
[--apiversion APIVERSION]
-p PACKAGE
[-a VERSIONNAME]
[-e VERSIONDESCRIPTION]
[-b BRANCH]
[-t TAG]
[-k INSTALLATIONKEY]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional
A username or alias for the target Dev Hub org. Overrides the default Dev Hub org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-p | --package PACKAGE
Required
The ID (starts with 04t) or alias of the package to update a version of.
Type: string
-a | --versionname VERSIONNAME
Optional
The new package version name.
Type: string
-e | --versiondescription VERSIONDESCRIPTION
Optional
The new package version description.
Type: string
112
Salesforce CLI Command Reference package1 Commands
-b | --branch BRANCH
Optional
The new package version branch.
Type: string
-t | --tag TAG
Optional
The new package version tag.
Type: string
-k | --installationkey INSTALLATIONKEY
Optional
The new installation key for the key-protected package. The default is null.
Type: string
package1 Commands
Use the package1 commands to create and view first-generation package versions in your Dev Hub org.
package1:version:create
Creates a first-generation package version in the release org.
package1:version:create:get
Retrieves the status of a package version creation request.
package1:version:display
Displays detailed information about an individual first-generation package version.
package1:version:list
Lists the versions for the specified package or all first-generation packages in the org.
package1:version:create
Creates a first-generation package version in the release org.
113
Salesforce CLI Command Reference package1 Commands
Command Syntax
sfdx force:package1:version:create
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
-i PACKAGEID
-n NAME
[-d DESCRIPTION]
[-v VERSION]
[-m]
[-r RELEASENOTESURL]
[-p POSTINSTALLURL]
[-k INSTALLATIONKEY]
[-w WAIT]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-i | --packageid PACKAGEID
Required
ID of the metadata package (starts with 033) of which you’re creating a new version.
114
Salesforce CLI Command Reference package1 Commands
Type: id
-n | --name NAME
Required
Package version name.
Type: string
-d | --description DESCRIPTION
Optional
Package version description.
Type: string
-v | --version VERSION
Optional
Package version in major.minor format, for example, 3.2.
Type: string
-m | --managedreleased
Optional
Creates a managed package version. To create a beta version, don’t include this parameter.
Type: boolean
-r | --releasenotesurl RELEASENOTESURL
Optional
Release notes URL.
Type: url
-p | --postinstallurl POSTINSTALLURL
Optional
Post install URL.
Type: url
-k | --installationkey INSTALLATIONKEY
Optional
Installation key for creating the key-protected package. The default is null.
Type: string
-w | --wait WAIT
Optional
Minutes to wait for the package version to be created. The default is 2 minutes.
Type: number
115
Salesforce CLI Command Reference package1 Commands
package1:version:create:get
Retrieves the status of a package version creation request.
Command Syntax
sfdx force:package1:version:create:get
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
-i REQUESTID
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-i | --requestid REQUESTID
Required
The ID of the PackageUploadRequest.
Type: id
116
Salesforce CLI Command Reference package1 Commands
package1:version:display
Displays detailed information about an individual first-generation package version.
Command Syntax
sfdx force:package1:version:display
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
-i PACKAGEVERSIONID
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-i | --packageversionid PACKAGEVERSIONID
Required
ID (starts with 04t) of the metadata package version whose details you want to display.
117
Salesforce CLI Command Reference package1 Commands
Type: id
package1:version:list
Lists the versions for the specified package or all first-generation packages in the org.
Command Syntax
sfdx force:package1:version:list
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-i PACKAGEID]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-i | --packageid PACKAGEID
Optional
118
Salesforce CLI Command Reference project Commands
Metadata package ID (starts with 033) whose package versions you want to list. If not specified, shows all versions for all packages
(managed and unmanaged) in the org.
Type: id
project Commands
Use the project commands to set up a Salesforce DX project.
project:create
Creates a Salesforce DX project in the specified directory or the current working directory. The command creates the necessary
configuration files and folders.
project:upgrade
Updates project configuration and definition files to the latest format.
project:create
Creates a Salesforce DX project in the specified directory or the current working directory. The command creates the necessary configuration
files and folders.
Command Syntax
sfdx force:project:create
[--json]
[--loglevel LOGLEVEL]
-n PROJECTNAME
[-t TEMPLATE]
[-d OUTPUTDIR]
[-s NAMESPACE]
[-p DEFAULTPACKAGEDIR]
[-x]
Parameters
--json
Optional
Formats output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
119
Salesforce CLI Command Reference project Commands
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-n | --projectname PROJECTNAME
Required
The name for the new project. Any valid folder name is accepted.
Type: string
-t | --template TEMPLATE
Optional
The template to use to create the project. Supplied parameter values or default values are filled into a copy of the template.
Type: string
Permissible values are: empty, standard, Defaultsfdx-project.json
Default value: empty
-d | --outputdir OUTPUTDIR
Optional
The directory to store the newly created files. The location can be an absolute path or relative to the current working directory. The
default is the current directory.
Type: string
-s | --namespace NAMESPACE
Optional
The namespace associated with this project and any connected scratch orgs.
Type: string
-p | --defaultpackagedir DEFAULTPACKAGEDIR
Optional
The default package directory name. Metadata items such as classes and Lightning bundles are placed inside this folder.
Type: string
Default value: force-app
-x | --manifest
Optional
Generates a default manifest (package.xml) for fetching Apex, Visualforce, Lightning web components, Aura components, and static
resources.
Type: boolean
project:upgrade
Updates project configuration and definition files to the latest format.
120
Salesforce CLI Command Reference schema Commands
Command Syntax
sfdx force:project:upgrade
[--json]
[--loglevel LOGLEVEL]
[-f]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-f | --forceupgrade
Optional
Run all upgrades, even if the project definition files have already been upgraded.
Type: boolean
schema Commands
Use the schema commands to view information about the standard and custom objects in your org.
schema:sobject:describe
Displays the metadata for a standard or custom object.
schema:sobject:list
Lists all objects of a specified sObject category.
schema:sobject:describe
Displays the metadata for a standard or custom object.
121
Salesforce CLI Command Reference schema Commands
Command Syntax
sfdx force:schema:sobject:describe
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
-s SOBJECTTYPE
[-t]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-s | --sobjecttype SOBJECTTYPE
Required
The API name of the object to describe.
Type: string
-t | --usetoolingapi
Optional
Execute using Tooling API.
Type: boolean
122
Salesforce CLI Command Reference schema Commands
schema:sobject:list
Lists all objects of a specified sObject category.
Command Syntax
sfdx force:schema:sobject:list
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
-c SOBJECTTYPECATEGORY
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
123
Salesforce CLI Command Reference source Commands
-c | --sobjecttypecategory SOBJECTTYPECATEGORY
Required
The type of objects to list: all, custom, or standard.
Type: string
source Commands
Use the source commands to push and pull source to and from your scratch orgs, to deploy and retrieve source to and from
non-source-tracked orgs, to see synchronization changes between your project and scratch orgs, and to convert your source to the
metadata format for Metadata API deployments.
source:convert
Converts source-formatted files into metadata that you can deploy using Metadata API.
source:delete (Beta)
Deletes source files from your project and from a non-source-tracked org, such as a sandbox.
source:deploy (Beta)
Deploys source to a non-source-tracked org, such as a sandbox.
source:open
Opens the specified Lightning Page in Lightning App Builder. Lightning Page files have the suffix .flexipage-meta.xml, and are stored
in the flexipages directory. If you specify a different type of file, this command opens your org’s home page.
source:pull
Pulls changed source from the scratch org to your project to keep them in sync.
source:push
Pushes changed source from your project to a scratch org to keep them in sync.
source:retrieve (Beta)
Retrieves source from a non-source-tracked org, such as a sandbox, to your local Salesforce DX project.
source:status
Lists changes that have been made locally, in a scratch org, or both.
source:convert
Converts source-formatted files into metadata that you can deploy using Metadata API.
124
Salesforce CLI Command Reference source Commands
Command Syntax
sfdx force:source:convert
[--json]
[--loglevel LOGLEVEL]
[-r ROOTDIR]
[-d OUTPUTDIR]
[-n PACKAGENAME]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-r | --rootdir ROOTDIR
Optional
A directory other than the default package directory that contains the source-formatted files to convert.
Type: directory
-d | --outputdir OUTPUTDIR
Optional
The output directory to store the Metadata API–formatted metadata files in.
Type: directory
-n | --packagename PACKAGENAME
Optional
The name of the package to associate with the metadata-formatted files.
Type: string
125
Salesforce CLI Command Reference source Commands
Examples:
$ sfdx force:source:convert -r path/to/source
source:delete (Beta)
Deletes source files from your project and from a non-source-tracked org, such as a sandbox.
Note: This release contains a beta version of the source:delete command, which means it’s a high-quality feature with
known limitations. The the source:delete command isn’t generally available unless or until Salesforce announces its general
availability in documentation or in press releases or public statements. We can’t guarantee general availability within any particular
time frame or at all. Make your purchase decisions only on the basis of generally available products and features. You can provide
feedback and suggestions for the source:delete command in the Salesforce CLI New Command Feedback group in the
Trailblazer Community.
Command Syntax
sfdx force:source:delete
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-r]
[-w WAIT]
[-p SOURCEPATH]
[-m METADATA]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
126
Salesforce CLI Command Reference source Commands
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-r | --noprompt
Optional
Do not prompt for delete confirmation.
Type: boolean
-w | --wait WAIT
Optional
Number of minutes to wait for the command to complete and display results to the terminal window. If the command continues
to run after the wait period, the CLI returns control of the terminal window to you. The default is 33 minutes.
Type: minutes
Default value: 33
-p | --sourcepath SOURCEPATH
Optional
A comma-separated list of paths to the local metadata to delete. The supplied paths can be a single file (in which case the operation
is applied to only one file) or a folder (in which case the operation is applied to all metadata types in the directory and its
sub-directories).
If you specify this parameter, don’t specify --manifest or --metadata.
Type: array
-m | --metadata METADATA
Optional
A comma-separated list of names of metadata components to delete from your project and your org.
Type: array
source:deploy (Beta)
Deploys source to a non-source-tracked org, such as a sandbox.
Note: This release contains a beta version of the source:deploy command, which means it’s a high-quality feature with
known limitations. The the source:deploy command isn’t generally available unless or until Salesforce announces its general
127
Salesforce CLI Command Reference source Commands
availability in documentation or in press releases or public statements. We can’t guarantee general availability within any particular
time frame or at all. Make your purchase decisions only on the basis of generally available products and features. You can provide
feedback and suggestions for the source:deploy command in the Salesforce CLI New Command Feedback group in the
Trailblazer Community.
Command Syntax
sfdx force:source:deploy
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-w WAIT]
[-m METADATA]
[-p SOURCEPATH]
[-x MANIFEST]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-w | --wait WAIT
Optional
Number of minutes to wait for the command to complete and display results to the terminal window. If the command continues
to run after the wait period, the CLI returns control of the terminal window to you. The default is 33 minutes.
128
Salesforce CLI Command Reference source Commands
Type: minutes
Default value: 33
-m | --metadata METADATA
Optional
A comma-separated list of names of metadata components to deploy to the org.
Type: array
-p | --sourcepath SOURCEPATH
Optional
A comma-separated list of paths to the local source files to deploy. The supplied paths can be to a single file (in which case the
operation is applied to only one file) or to a folder (in which case the operation is applied to all metadata types in the directory and
its sub-directories).
If you specify this parameter, don’t specify --manifest or --metadata.
Type: array
-x | --manifest MANIFEST
Optional
The complete path for the manifest (package.xml) file that specifies the components to deploy.
If you specify this parameter, don’t specify --metadata or --sourcepath.
Type: filepath
To deploy a specific Apex class and the objects whose source is in a directory:
$ sfdx force:source:deploy -p path/to/apex/classes/MyClass.cls,path/to/source/objects
129
Salesforce CLI Command Reference source Commands
To deploy all Apex classes and two specific profiles (one of which has a space in its name):
$ sfdx force:source:deploy -m "ApexClass, Profile:My Profile, Profile: AnotherProfile"
source:open
Opens the specified Lightning Page in Lightning App Builder. Lightning Page files have the suffix .flexipage-meta.xml, and are stored in
the flexipages directory. If you specify a different type of file, this command opens your org’s home page.
Command Syntax
sfdx force:source:open
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
-f SOURCEFILE
[-r]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
130
Salesforce CLI Command Reference source Commands
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-f | --sourcefile SOURCEFILE
Required
File to edit.
Type: filepath
-r | --urlonly
Optional
Generate a navigation URL path, but don’t launch a browser-based editor.
Type: boolean
source:pull
Pulls changed source from the scratch org to your project to keep them in sync.
Command Syntax
sfdx force:source:pull
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-w WAIT]
[-f]
Parameters
--json
Optional
Format output as JSON.
131
Salesforce CLI Command Reference source Commands
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-w | --wait WAIT
Optional
The number of minutes to wait for the command to complete and display results to the terminal window. If the command continues
to run after the wait period, the CLI returns control of the terminal window to you. The default is 33 minutes.
Type: minutes
Default value: 33
-f | --forceoverwrite
Optional
Runs the pull command even if conflicts exist. Changes in the scratch org overwrite changes in the project.
Type: boolean
source:push
Pushes changed source from your project to a scratch org to keep them in sync.
Command Syntax
sfdx force:source:push
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
132
Salesforce CLI Command Reference source Commands
[-f]
[-g]
[-w WAIT]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-f | --forceoverwrite
Optional
Runs the push command even if conflicts exist. Changes in the project overwrite changes in the scratch org.
Type: boolean
-g | --ignorewarnings
Optional
Completes the deployment even if warnings are generated.
Type: boolean
-w | --wait WAIT
Optional
Number of minutes to wait for the command to complete and display results to the terminal window. If the command continues
to run after the wait period, the CLI returns control of the terminal window to you. The default is 33 minutes.
Type: minutes
Default value: 33
133
Salesforce CLI Command Reference source Commands
source:retrieve (Beta)
Retrieves source from a non-source-tracked org, such as a sandbox, to your local Salesforce DX project.
Note: This release contains a beta version of the source:retrieve command, which means it’s a high-quality feature with
known limitations. The the source:retrieve command isn’t generally available unless or until Salesforce announces its
general availability in documentation or in press releases or public statements. We can’t guarantee general availability within any
particular time frame or at all. Make your purchase decisions only on the basis of generally available products and features. You
can provide feedback and suggestions for the source:retrieve command in the Salesforce CLI New Command Feedback
group in the Trailblazer Community.
Command Syntax
sfdx force:source:retrieve
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-w WAIT]
[-x MANIFEST]
[-m METADATA]
[-p SOURCEPATH]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
134
Salesforce CLI Command Reference source Commands
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-w | --wait WAIT
Optional
Number of minutes to wait for the command to complete and display results to the terminal window. If the command continues
to run after the wait period, the CLI returns control of the terminal window to you. The default is 33 minutes.
Type: minutes
Default value: 33
-x | --manifest MANIFEST
Optional
The complete path for the manifest (package.xml) file that specifies the components to retrieve.
If you specify this parameter, don’t specify --metadata or --sourcepath.
Type: filepath
-m | --metadata METADATA
Optional
A comma-separated list of names of metadata components to retrieve from the org.
Type: array
-p | --sourcepath SOURCEPATH
Optional
A comma-separated list of file paths for source to retrieve from the org. The supplied paths can be to a single file (in which case the
operation is applied to only one file) or to a folder (in which case the operation is applied to all source files in the directory and its
sub-directories).
Type: array
To retrieve a specific Apex class and the objects whose source is in a directory:
$ sfdx force:source:retrieve -p path/to/apex/classes/MyClass.cls,path/to/source/objects
135
Salesforce CLI Command Reference source Commands
To retrieve all Apex classes and two specific profiles (one of which has a space in its name):
$ sfdx force:source:retrieve -m "ApexClass, Profile:My Profile, Profile: AnotherProfile"
source:status
Lists changes that have been made locally, in a scratch org, or both.
Command Syntax
sfdx force:source:status
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-a]
[-l]
[-r]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
136
Salesforce CLI Command Reference user Commands
$ sfdx force:source:status -r
$ sfdx force:source:status -a
user Commands
Use the user commands to perform user-related admin tasks.
user:create
Creates a user for a scratch org.
user:display
Displays information about a user of a scratch org that the Salesforce CLI has created or authenticated.
137
Salesforce CLI Command Reference user Commands
user:list
Lists all users of a scratch org that the Salesforce CLI has created or authenticated.
user:password:generate
Generates a password for scratch org users. Targets the usernames listed with the --onbehalfof parameter or the --targetusername
parameter. Defaults to the defaultusername.
user:permset:assign
Assigns a named permission set to one or more users of an org.
user:create
Creates a user for a scratch org.
Command Syntax
sfdx force:user:create
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-f DEFINITIONFILE]
[-a SETALIAS]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional
A username or alias for the target Dev Hub org. Overrides the default Dev Hub org.
Type: string
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
138
Salesforce CLI Command Reference user Commands
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-f | --definitionfile DEFINITIONFILE
Optional
File path to a user definition.
Type: filepath
-a | --setalias SETALIAS
Optional
Sets an alias for the created username to reference within the CLI.
Type: string
user:display
Displays information about a user of a scratch org that the Salesforce CLI has created or authenticated.
Command Syntax
sfdx force:user:display
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
139
Salesforce CLI Command Reference user Commands
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional
A username or alias for the target Dev Hub org. Overrides the default Dev Hub org.
Type: string
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
user:list
Lists all users of a scratch org that the Salesforce CLI has created or authenticated.
Command Syntax
sfdx force:user:list
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
140
Salesforce CLI Command Reference user Commands
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional
A username or alias for the target Dev Hub org. Overrides the default Dev Hub org.
Type: string
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
user:password:generate
Generates a password for scratch org users. Targets the usernames listed with the --onbehalfof parameter or the --targetusername
parameter. Defaults to the defaultusername.
141
Salesforce CLI Command Reference user Commands
Command Syntax
sfdx force:user:password:generate
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-o ONBEHALFOF]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional
A username or alias for the target Dev Hub org. Overrides the default Dev Hub org.
Type: string
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-o | --onbehalfof ONBEHALFOF
Optional
A comma-separated list of usernames for which to generate passwords.
Type: array
142
Salesforce CLI Command Reference user Commands
user:permset:assign
Assigns a named permission set to one or more users of an org.
Command Syntax
sfdx force:user:permset:assign
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
-n PERMSETNAME
[-o ONBEHALFOF]
Parameters
--json
Optional
Format output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-u | --targetusername TARGETUSERNAME
Optional
A username or alias for the target org. Overrides the default target org.
Type: string
143
Salesforce CLI Command Reference visualforce Commands
--apiversion APIVERSION
Optional
Override the API version used for API requests made by this command.
Type: string
-n | --permsetname PERMSETNAME
Required
The name of the permission set to assign.
Type: string
-o | --onbehalfof ONBEHALFOF
Optional
Comma-separated list of usernames or aliases to assign the permission set to.
Type: array
visualforce Commands
Use the visualforce commands to create Visualforce pages and components.
visualforce:component:create
Creates a Visualforce component in the specified directory or the current working directory. The command creates the .component
file and associated metadata file.
visualforce:page:create
Creates a Visualforce page in the specified directory or the current working directory. The command creates the .page file and
associated metadata file.
visualforce:component:create
Creates a Visualforce component in the specified directory or the current working directory. The command creates the .component file
and associated metadata file.
Command Syntax
sfdx force:visualforce:component:create
[--json]
[--loglevel LOGLEVEL]
144
Salesforce CLI Command Reference visualforce Commands
[-t TEMPLATE]
[-d OUTPUTDIR]
-n COMPONENTNAME
[-a APIVERSION]
-l LABEL
Parameters
--json
Optional
Formats output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-t | --template TEMPLATE
Optional
The template to use to create the file. Supplied parameter values or default values are filled into a copy of the template.
Type: string
Permissible values are: DefaultVFComponent
Default value: DefaultVFComponent
-d | --outputdir OUTPUTDIR
Optional
The directory to store the newly created files. The location can be an absolute path or relative to the current working directory. The
default is the current directory.
Type: string
-n | --componentname COMPONENTNAME
Required
The Visualforce component name. The name can be up to 40 characters and must start with a letter.
Type: string
-a | --apiversion APIVERSION
Optional
The API version of the created source.
Type: string
Permissible values are: 45.0, 44.0
Default value: 45.0
145
Salesforce CLI Command Reference visualforce Commands
-l | --label LABEL
Required
The label saved in the metadata for the Visualforce component.
Type: string
visualforce:page:create
Creates a Visualforce page in the specified directory or the current working directory. The command creates the .page file and associated
metadata file.
Command Syntax
sfdx force:visualforce:page:create
[--json]
[--loglevel LOGLEVEL]
[-t TEMPLATE]
[-d OUTPUTDIR]
-n PAGENAME
[-a APIVERSION]
-l LABEL
Parameters
--json
Optional
Formats output as JSON.
Type: boolean
--loglevel LOGLEVEL
Optional
The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.log.
Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: warn
-t | --template TEMPLATE
Optional
The template to use to create the file. Supplied parameter values or default values are filled into a copy of the template.
Type: string
Permissible values are: DefaultVFPage
Default value: DefaultVFPage
146
Salesforce CLI Command Reference Help for Salesforce CLI Commands
-d | --outputdir OUTPUTDIR
Optional
The directory to store the newly created files. The location can be an absolute path or relative to the current working directory. The
default is the current directory.
Type: string
-n | --pagename PAGENAME
Required
The Visualforce page name. The name can be up to 40 characters and must start with a letter.
Type: string
-a | --apiversion APIVERSION
Optional
The API version of the created source.
Type: string
Permissible values are: 45.0, 44.0
Default value: 45.0
-l | --label LABEL
Required
The label saved in the metadata for the Visualforce page.
Type: string
2. Usage
The command signature on the Usage line uses the docopt format.
• All available parameters are listed. Parameters that have short names are listed using their short names.
147
Salesforce CLI Command Reference CLI Deprecation Policy
• Parameters that take a value show the value’s type (for example, <string>) in angle brackets immediately after the parameter’s
name.
• Optional parameters are in square brackets ([ … ]).
• Required parameters have no annotation.
• For parameters that accept a limited set of values, the values are shown after the parameter name, separated by pipes
(--parametername value1|value2|value3).
• Mutually exclusive options are shown in parentheses, separated by a pipe (( … | … )).
If the command takes varargs (name-value pairs that aren’t parameters), the usage signature includes name=value....
Tip: To see signatures for all commands in the force namespace, run sfdx force:doc:commands:list
--usage.
3. Options
The Options section lists all the command’s parameters, including their short name, long name, and purpose. For parameters that
accept a value, the value name is written after an equals sign (=). The equals sign is optional when you run the command—for
example, you could run sfdx force:org:create -f=config/enterprise-scratch-def.json -a TestOrg1
or sfdx force:org:create -f config/enterprise-scratch-def.json -a TestOrg1 with the same
results.
Parameters that accept a limited list of values include the values in parentheses, with the default value indicated by an asterisk (*).
For more information about the parameters, see the Salesforce CLI Command Reference.
4. Description
Usage notes and examples are below the list of parameters, in the Description section. This information is also available in the
Salesforce CLI Command Reference.
148