Newer Version Available
source Commands
source:convert
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
Help for source:convert
To convert source-formatted files into the metadata format, so that you can deploy them using Metadata API, run "sfdx force:source:convert". Then deploy the metadata using "sfdx force:mdapi:deploy".
To convert Metadata API–formatted files into the source format, run "sfdx force:mdapi:convert".
To specify a package name that includes spaces, enclose the name in single quotes.
Examples:
1$ sfdx force:source:convert -r path/to/source1$ sfdx force:source:convert -r path/to/source -d path/to/outputdir -n 'My Package'source:delete (Beta)
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.
- 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
Help for source:delete
Use this command to delete components from orgs that don’t have source tracking, such as sandboxes.
To remove deleted items from scratch orgs, which have change tracking, use "sfdx force:source:push".
Examples:
1$ sfdx force:source:delete -p path/to/source1$ sfdx force:source:delete -m <metadata>source:deploy (Beta)
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.
- 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
Help for source:deploy
Use this command to deploy source to orgs that don’t have source tracking, such as sandboxes.
To push source to scratch orgs, which have change tracking, use "sfdx force:source:push".
To deploy metadata that’s in the Metadata API format, use "sfdx force:mdapi:deploy".
The source you deploy overwrites the corresponding metadata in your org. This command does not attempt to merge your source with the versions in your org.
If the comma-separated list you’re supplying contains spaces, enclose the entire comma-separated list in one set of double quotes.
Examples:
To deploy the source files in a directory:
1$ sfdx force:source:deploy -p path/to/sourceTo deploy a specific Apex class and the objects whose source is in a directory:
1$ sfdx force:source:deploy -p path/to/apex/classes/MyClass.cls,path/to/source/objectsTo deploy source files in a comma-separated list that contains spaces:
1$ sfdx force:source:deploy -p "path/to/objects/MyCustomObject/fields/MyField.field-meta.xml, path/to/apex/classes"To deploy all Apex classes:
1$ sfdx force:source:deploy -m ApexClassTo deploy a specific Apex class:
1$ sfdx force:source:deploy -m ApexClass:MyApexClassTo deploy all custom objects and Apex classes:
1$ sfdx force:source:deploy -m CustomObject,ApexClassTo deploy all Apex classes and two specific profiles (one of which has a space in its name):
1$ sfdx force:source:deploy -m "ApexClass, Profile:My Profile, Profile: AnotherProfile"To deploy all components listed in a manifest:
1$ sfdx force:source:deploy -x path/to/package.xmlsource:open
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
- --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
Help for source:open
The file opens in your default browser.
If no browser-based editor is available for the selected file, this command opens your org’s home page.
To generate a URL for the browser-based editor but not open the editor, use --urlonly.
Examples:
1$ sfdx force:source:open -f Property_Record_Page.flexipage-meta.xml1$ sfdx force:source:open -f Property_Record_Page.flexipage-meta.xml -rsource:pull
Command Syntax
- sfdx force:source:pull
- [--json]
- [--loglevel LOGLEVEL]
- [-u TARGETUSERNAME]
- [--apiversion APIVERSION]
- [-w WAIT]
- [-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
- -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
Help for source:pull
If the command detects a conflict, it displays the conflicts but does not complete the process. After reviewing the conflict, rerun the command with the --forceoverwrite parameter.
source:push
Command Syntax
- sfdx force:source:push
- [--json]
- [--loglevel LOGLEVEL]
- [-u TARGETUSERNAME]
- [--apiversion APIVERSION]
- [-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
Help for source:push
If the command detects a conflict, it displays the conflicts but does not complete the process. After reviewing the conflict, rerun the command with the --forceoverwrite parameter.
source:retrieve (Beta)
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
- --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
Help for source:retrieve
Use this command to retrieve source from orgs that don’t have source tracking, such as sandboxes.
To pull source from scratch orgs, which have change tracking, use "sfdx force:source:pull".
To retrieve metadata that’s in the Metadata API format, use "sfdx force:mdapi:retrieve".
The source you retrieve overwrites the corresponding source files in your local project. This command does not attempt to merge the source from your org with your local source files.
If the comma-separated list you’re supplying contains spaces, enclose the entire comma-separated list in one set of double quotes.
Examples:
To retrieve the source files in a directory:
1$ sfdx force:source:retrieve -p path/to/sourceTo retrieve a specific Apex class and the objects whose source is in a directory:
1$ sfdx force:source:retrieve -p path/to/apex/classes/MyClass.cls,path/to/source/objectsTo retrieve source files in a comma-separated list that contains spaces:
1$ sfdx force:source:retrieve -p "path/to/objects/MyCustomObject/fields/MyField.field-meta.xml, path/to/apex/classes"To retrieve all Apex classes:
1$ sfdx force:source:retrieve -m ApexClassTo retrieve a specific Apex class:
1$ sfdx force:source:retrieve -m ApexClass:MyApexClassTo retrieve all custom objects and Apex classes:
1$ sfdx force:source:retrieve -m CustomObject,ApexClassTo retrieve all Apex classes and two specific profiles (one of which has a space in its name):
1$ sfdx force:source:retrieve -m "ApexClass, Profile:My Profile, Profile: AnotherProfile"To retrieve all metadata components listed in a manifest:
1$ sfdx force:source:retrieve -x path/to/package.xmlsource:status
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
- 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 | --all
- Optional
-
Lists all the changes that have been made.
- Type: boolean
- -l | --local
- Optional
-
Lists the changes that have been made locally.
- Type: boolean
- -r | --remote
- Optional
-
Lists the changes that have been made in the scratch org.
- Type: boolean
Help for source:status
Examples:
1$ sfdx force:source:status -l1$ sfdx force:source:status -r1$ sfdx force:source:status -a1$ sfdx force:source:status -a -u me@example.com --json