Newer Version Available

This content describes an older version of this product. View Latest

source Commands (Deprecated)

Use the source commands to push and pull source to and from source-tracked orgs, to deploy and retrieve source to and from orgs, to see synchronization changes between your project and source-tracked orgs, and to convert your source to the metadata format for Metadata API deployments.

force:source:convert (Deprecated)

Convert source into Metadata API format .

As of April 13, 2023, this command is deprecated and we no longer update this topic.

Don't worry, this command and its flags continue to work the same as before, and any scripts that use the command won’t break. However, we recommend that you start using the equivalent sf-style project convert source command instead. Here’s how the flags changed between the old and new commands; if a flag isn't listed, the old and new names are the same:

  • Removed flag: --loglevel
  • New flag: --api-version
  • Changed flag name: Old name --outputdir. New name: --output-dir.
  • Changed flag name: Old name --packagename. New name: --package-name.
  • Changed flag name: Old name --rootdir. New name: --root-dir.
  • Changed flag name: Old name --sourcepath. New name: --source-dir.

For background information about this change, read this blog post, which describes how we've updated many of the existing sfdx commands to use the improvements we made in sf. We improved this particular command on April 13, 2023.

Warning

Help for force:source:convert

Converts source-formatted files into metadata that you can deploy using Metadata API.

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 for force:source:convert

1sfdx force:source:convert -r path/to/source
1sfdx force:source:convert -r path/to/source -d path/to/outputdir -n 'My Package'

Command Syntax

sfdx force:source:convert
[--json]
[--loglevel LOGLEVEL]
[-r ROOTDIR]
[-d OUTPUTDIR]
[-n PACKAGENAME]
[-x MANIFEST]
[-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/.sf/sf.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-r | --rootdir ROOTDIR
Optional

A source directory other than the default package to convert.

Type: directory
-d | --outputdir OUTPUTDIR
Optional

Output directory to store the Metadata API–formatted files in.

Type: directory
Default value: metadataPackage_1676579552285
-n | --packagename PACKAGENAME
Optional

Name of the package to associate with the metadata-formatted files.

Type: string
-x | --manifest MANIFEST
Optional

The complete path to the manifest (package.xml) file that specifies the metadata types to convert.

If you specify this parameter, don’t specify --metadata or --sourcepath.

Type: string
-p | --sourcepath SOURCEPATH
Optional

A comma-separated list of paths to the local source files to convert. 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
-m | --metadata METADATA
Optional

Comma-separated list of metadata component names to convert.

Type: array

force:source:delete (Deprecated)

Delete source from your project and from a non-source-tracked org.

As of April 13, 2023, this command is deprecated and we no longer update this topic.

Don't worry, this command and its flags continue to work the same as before, and any scripts that use the command won’t break. However, we recommend that you start using the equivalent sf-style project delete source command instead. Here’s how the flags changed between the old and new commands; if a flag isn't listed, the old and new names are the same:

  • Removed flag: --loglevel
  • Changed flag name: Old name --apiversion. New name: --api-version.
  • Changed flag name: Old name --checkonly. New name: --check-only.
  • Changed flag name: Old name --forceoverwrite. New name: --force-overwrite.
  • Changed flag name: Old name --noprompt. New name: --no-prompt.
  • Changed flag name: Old name --sourcepath. New name: --source-dir.
  • Changed flag name: Old name --targetusername. New name: --target-org, with new short name -o.
  • Changed flag name: Old name --testlevel. New name: --test-level.
  • Changed flag name: Old name --tracksource. New name: --track-source.

For background information about this change, read this blog post, which describes how we've updated many of the existing sfdx commands to use the improvements we made in sf. We improved this particular command on April 13, 2023.

Warning

Help for force:source:delete

IMPORTANT: Where possible, we changed noninclusive terms to align with our company value of Equality. We maintained certain terms to avoid any effect on customer implementations.

Use this command to delete components from orgs that don’t have source tracking.

To remove deleted items from scratch orgs, which have change tracking, use "sfdx force:source:push".

Examples for force:source:delete

1sfdx force:source:delete -m <metadata>
1sfdx force:source:delete -p path/to/source

Command Syntax

sfdx force:source:delete
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-c]
[-w WAIT]
[-l TESTLEVEL]
[-r]
[-m METADATA]
[-p SOURCEPATH]
[-t]
[-f]
[--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/.sf/sf.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, 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 deleted metadata and runs all Apex tests, but prevents the deletion 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 deletion (validation). This kind of change isn’t supported for test deletions to avoid the risk of data loss or corruption. If a change that isn’t supported for test deletions is included in a deletion package, the test deletion fails and issues an error.

If your deletion 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 deletion to another test Sandbox. A full deletion includes a validation of the changes as part of the deletion process.

Note: A Metadata API deletion that includes Master-Detail relationships deletes all detail records in the Recycle Bin in the following cases.

1. For a deletion with a new Master-Detail field, soft delete (send to the Recycle Bin) all detail records before proceeding to delete the Master-Detail field, or the deletion fails. During the deletion, detail records are permanently deleted from the Recycle Bin and cannot be recovered.

2. For a deletion 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 deletion to succeed. However, a successful deletion permanently deletes any detail records in the Recycle Bin.

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.

Type: minutes
Default value: 33 minutes
-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.

RunLocalTests—All tests in your org are run, except the ones that originate from installed managed and unlocked 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: enum
Permissible values are: NoTestRun, RunLocalTests, RunAllTestsInOrg
Default value: NoTestRun
-r | --noprompt
Optional

Do not prompt for delete confirmation.

Type: boolean
-m | --metadata METADATA
Optional

A comma-separated list of names of metadata components to delete from your project and your org.

If you specify this parameter, don’t specify --sourcepath.

Type: array
-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 --metadata.

Type: array
-t | --tracksource
Optional

If the delete succeeds, update the source tracking information, similar to push.

Type: boolean
-f | --forceoverwrite
Optional

Ignore conflict warnings and overwrite changes to the org.

Type: boolean
--verbose
Optional

Emit additional command output to stdout.

Type: boolean

force:source:deploy (Deprecated)

Deploy source to an org.

As of April 13, 2023, this command is deprecated and we no longer update this topic.

Don't worry, this command and its flags continue to work the same as before, and any scripts that use the command won’t break. However, we recommend that you start using the equivalent sf-style project deploy start command instead.

Use this table to map the flags between the old and new commands. The mapping isn’t always one-to-one; see the Notes column for more information.

force:source:deploy Flag Equivalent project deploy start Flag Notes
-c, --checkonly --dry-run, no short name. You can also use project deploy validate
-f, --forceoverwrite -c, --ignore-conflicts Note the new long and short flag name.
-x, --manifest -x, --manifest
-m, --metadata -m, --metadata
-o, --ignoreerrors -r, --ignore-errors Note the new short flag name.
-g, --ignorewarnings -g, --ignore-warnings
-p, --sourcepath -d, --source-dir Note the new short flag name.
-l, --testlevel -l, --test-level
-u, --targetusername -o, --target-org Note the new short flag name.
-t, --tracksource No equivalent. The project deploy start command always keeps track of your source if the org is enabled for source-tracking. If you don't want to use source tracking, create an org that doesn't have source tracking enabled.
-q, --validateddeployrequestid No equivalent. Use the project deploy validate and project deploy quick --job-id commands.
-r, --runtests -t, --tests
-w, --wait -w, --wait
--apiversion -a, --api-version
--concise --concise
--coverageformatters --coverage-formatters
--json --json
--junit --junit
--loglevel No equivalent.
--predestructivechanges --pre-destructive-changes
--postdestructivechanges --post-destructive-changes
--purgeondelete --purge-on-delete
--resultsdir --results-dir
--soapdeploy No equivalent. Deploys use SOAP API by default. To use REST API, set the org-metadata-rest-deploy config variable or SF_ORG_METADATA_REST_DEPLOY environment variable.
--verbose --verbose

Here are some examples to help you update your old commands. This sfdx-style command:

1sfdx force:source:deploy --metadata "ApexClass,CustomObject" --testlevel RunSpecifiedTests --runtests MyTests --targetusername my-scratch

Looks like this using the equivalent sf-style command:

1sf project deploy start --metadata ApexClass --metadata CustomObject --test-level RunSpecifiedTests --tests MyTests --target-org my-scratch

This sfdx-style command:

1sfdx force:source:deploy --manifest package.xml --predestructivechanges destructiveChangesPre.xml --check-only

Looks like this using the equivalent sf-style command:

1sf project deploy start --manifest package.xml --pre-destructive-changes destructiveChangesPre.xml --dry-run

This sfdx-style command:

1sfdx force:source:deploy --sourcepath "path/to/objects/MyCustomObject/fields/MyField.field-meta.xml, path/to/apex/classes"

Looks like this using the equivalent sf-style command:

1sf project deploy start --source-dir path/to/objects/MyCustomObject/fields/MyField.field-meta.xml --source-dir path/to/apex/classes

For background information about this change, read this blog post, which describes how we've updated many of the existing sfdx commands to use the improvements we made in sf. We improved this particular command on April 13, 2023.

Warning

Help for force:source:deploy

IMPORTANT: Where possible, we changed noninclusive terms to align with our company value of Equality. We maintained certain terms to avoid any effect on customer implementations.

Use this command to deploy source (metadata that’s in source format) to an org.

To take advantage of change tracking with scratch orgs, use "sfdx force:source:push".

To deploy metadata that’s in metadata 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.

To run the command asynchronously, set --wait to 0, which immediately returns the job ID. This way, you can continue to use the CLI.

To check the status of the job, use force:source:deploy:report.

If the comma-separated list you’re supplying contains spaces, enclose the entire comma-separated list in one set of double quotes. On Windows, if the list contains commas, also enclose the entire list in one set of double quotes.

If you use the --manifest, --predestructivechanges, or --postdestructivechanges parameters, run the force:source:manifest:create command to easily generate the different types of manifest files.

Examples for force:source:deploy

To deploy the source files in a directory:

1sfdx force:source:deploy -p path/to/source

To deploy a specific Apex class and the objects whose source is in a directory:

1sfdx force:source:deploy -p "path/to/apex/classes/MyClass.cls,path/to/source/objects"

To deploy source files in a comma-separated list that contains spaces:

1sfdx force:source:deploy -p "path/to/objects/MyCustomObject/fields/MyField.field-meta.xml, path/to/apex/classes"

To deploy all Apex classes:

1sfdx force:source:deploy -m ApexClass

To deploy a specific Apex class:

1sfdx force:source:deploy -m ApexClass:MyApexClass

To deploy a specific Apex class and update source tracking files :

1sfdx force:source:deploy -m ApexClass:MyApexClass --tracksource

To deploy all custom objects and Apex classes:

1sfdx force:source:deploy -m "CustomObject,ApexClass"

To deploy all Apex classes and two specific profiles (one of which has a space in its name):

1sfdx force:source:deploy -m "ApexClass, Profile:My Profile, Profile: AnotherProfile"

To deploy all components listed in a manifest:

1sfdx force:source:deploy -x path/to/package.xml

To run the tests that aren’t in any managed packages as part of a deployment:

1sfdx force:source:deploy -m ApexClass -l RunLocalTests

To check whether a deployment would succeed (to prepare for Quick Deploy):

1sfdx force:source:deploy -m ApexClass -l RunAllTestsInOrg -c

To deploy an already validated deployment (Quick Deploy):

1sfdx force:source:deploy -q 0Af9A00000FTM6pSAH`

To run a destructive operation before the deploy occurs:

1sfdx force:source:deploy --manifest package.xml --predestructivechanges destructiveChangesPre.xml

To run a destructive operation after the deploy occurs:

1sfdx force:source:deploy --manifest package.xml --postdestructivechanges destructiveChangesPost.xml

Command Syntax

sfdx force:source:deploy
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-c]
[--soapdeploy]
[-w WAIT]
[-l TESTLEVEL]
[-r RUNTESTS]
[-o]
[-g]
[--purgeondelete]
[-q VALIDATEDDEPLOYREQUESTID]
[--verbose]
[-m METADATA]
[-p SOURCEPATH]
[-x MANIFEST]
[--predestructivechanges PREDESTRUCTIVECHANGES]
[--postdestructivechanges POSTDESTRUCTIVECHANGES]
[-t]
[-f]
[--resultsdir RESULTSDIR]
[--coverageformatters COVERAGEFORMATTERS]
[--junit]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sf/sf.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, 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
--soapdeploy
Optional

Deploy metadata with SOAP API instead of REST API.

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.

Type: minutes
Default value: 33 minutes
-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 and unlocked 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: enum
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
-o | --ignoreerrors
Optional

Ignores the deploy errors, and continues with the deploy operation. The default is false. Keep this parameter set to false when deploying to a production org. If set to true, components without errors are deployed, and components with errors are skipped.

Type: boolean
-g | --ignorewarnings
Optional

If a warning occurs and ignoreWarnings is set to true, the success field in DeployMessage is true. When ignoreWarnings is set to false, success is set to false, and the warning is treated like an error.

Type: boolean
--purgeondelete
Optional

Specify that deleted components in the destructive changes manifest file are immediately eligible for deletion rather than being stored in the Recycle Bin.

Type: boolean
-q | --validateddeployrequestid VALIDATEDDEPLOYREQUESTID
Optional

Specifies the ID of a package with recently validated components to run a Quick Deploy. Deploying a validation helps you shorten your deployment time because tests aren’t rerun. If you have a recent successful validation, you can deploy the validated components without running tests. A validation doesn’t save any components in the org. You use a validation only to check the success or failure messages that you would receive with an actual deployment. To validate your components, add the -c | --checkonly flag when you run "sfdx force:mdapi:deploy". This flag sets the checkOnly="true" parameter for your deployment. Before deploying a recent validation, ensure that the following requirements are met:

1. The components have been validated successfully for the target environment within the last 10 days.

2. As part of the validation, Apex tests in the target org have passed.

3. Code coverage requirements are met.

- If all tests in the org or all local tests are run, overall code coverage is at least 75%, and Apex triggers have some coverage.

- If specific tests are run with the RunSpecifiedTests test level, each class and trigger that was deployed is covered by at least 75% individually.

Type: id
--verbose
Optional

Emit additional command output to stdout.

Type: boolean
-m | --metadata METADATA
Optional

A comma-separated list of names of metadata components to deploy to the org.

If you specify this parameter, don’t specify --manifest or --sourcepath.

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. All child components are included.

If you specify this parameter, don’t specify --metadata or --sourcepath.

Type: filepath
--predestructivechanges PREDESTRUCTIVECHANGES
Optional

File path for a manifest (destructiveChangesPre.xml) of components to delete before the deploy.

Type: filepath
--postdestructivechanges POSTDESTRUCTIVECHANGES
Optional

File path for a manifest (destructiveChangesPost.xml) of components to delete after the deploy.

Type: filepath
-t | --tracksource
Optional

If the deploy succeeds, update source tracking information; doesn't delete locally deleted files from org unless you also specify --predestructivechanges or --postdestructivechanges.

Type: boolean
-f | --forceoverwrite
Optional

Ignore conflict warnings and overwrite changes to the org.

Type: boolean
--resultsdir RESULTSDIR
Optional

Output directory for code coverage and JUnit results; defaults to the deploy ID.

Type: directory
--coverageformatters COVERAGEFORMATTERS
Optional

Format of the code coverage results.

Type: array
--junit
Optional

Output JUnit test results.

Type: boolean

force:source:deploy:cancel (Deprecated)

Cancel a source deployment.

As of April 13, 2023, this command is deprecated and we no longer update this topic.

Don't worry, this command and its flags continue to work the same as before, and any scripts that use the command won’t break. However, we recommend that you start using the equivalent sf-style project deploy cancel command instead.

Use this table to map the flags between the old and new commands.

force:source:deploy:cancel Flag Equivalent project deploy cancel Flag Notes
-i, --jobid -i, --job-id
-u, --targetusername -o, --target-org Note the new short flag name.
-w, --wait -w, --wait
--apiversion -a, --api-version
--json --json
--loglevel No equivalent.

Here's an example to help you update your old commands. This sfdx-style command:

1sfdx force:source:deploy:cancel --wait 2 --jobid 1234

Looks like this using the equivalent sf-style command:

1sf project deploy cancel --wait 2 --job-id 1234

For background information about this change, read this blog post, which describes how we've updated many of the existing sfdx commands to use the improvements we made in sf. We improved this particular command on April 13, 2023.

Warning

Help for force:source:deploy:cancel

Use this command to cancel a specified asynchronous source deployment. You can also specify a wait time (in minutes) to check for updates to the canceled deploy status.

To run the command asynchronously, set --wait to 0, which immediately returns the job ID. This way, you can continue to use the CLI.

To check the status of the job, use force:source:deploy:report.

Examples for force:source:deploy:cancel

Deploy a directory of files to the org

1sfdx force:source:deploy -d <directory>

Now cancel this deployment and wait two minutes

1sfdx force:source:deploy:cancel -w 2

If you have multiple deployments in progress and want to cancel a specific one, specify the job ID

1sfdx force:source:deploy:cancel -i <jobid>

Check the status of the cancel job

1sfdx force:source:deploy:report

Command Syntax

sfdx force:source: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/.sf/sf.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, 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.

Type: minutes
Default value: 33 minutes
-i | --jobid JOBID
Optional

Job ID of the deployment you want to cancel; defaults to your most recent CLI deployment if not specified.

Type: id

force:source:deploy:report (Deprecated)

Check the status of a metadata deployment .

As of April 13, 2023, this command is deprecated and we no longer update this topic.

Don't worry, this command and its flags continue to work the same as before, and any scripts that use the command won’t break. However, we recommend that you start using the equivalent sf-style commands.

This command (force:source:deploy:report) does more than just report: it also resumes a deployment, which is confusing. For this reason, we now provide these two new commands for each task, which is much more intuitive:

Use this table to map the flags between the old and new commands.

force:source:deploy:report Flag Equivalent project deploy report or project deploy resume Flag Notes
-i, --jobid -i, --job-id
-u, --targetusername -o, --target-org Note the new short flag name.
-w, --wait -w, --wait
--apiversion No equivalent. API version isn't needed for this command.
--coverageformatters --coverage-formatters
--json --json
--junit --junit
--loglevel No equivalent.
--resultsdir --results-dir
--verbose --verbose

Here's an example to help you update your old commands. This sfdx-style command:

1sfdx force:source:deploy:report --jobid 1234 --wait 10

Looks like this using the equivalent sf-style command:

1sf project deploy report --job-id 1234 --wait 10

For background information about this change, read this blog post, which describes how we've updated many of the existing sfdx commands to use the improvements we made in sf. We improved this particular command on April 13, 2023.

Warning

Help for force:source:deploy:report

Specify the job ID for the deploy you want to check. You can also specify a wait time (minutes) to check for updates to the deploy status.

Examples for force:source:deploy:report

Deploy a directory of files to the org

1sfdx force:source:deploy -d <directory>

Now cancel this deployment and wait two minutes

1sfdx force:source:deploy:cancel -w 2

If you have multiple deployments in progress and want to cancel a specific one, specify the job ID

1sfdx force:source:deploy:cancel -i <jobid>

Check the status of the cancel job

1sfdx force:source:deploy:report

Command Syntax

sfdx force:source:deploy:report
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-w WAIT]
[-i JOBID]
[--verbose]
[--resultsdir RESULTSDIR]
[--coverageformatters COVERAGEFORMATTERS]
[--junit]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sf/sf.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, 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.

Type: minutes
Default value: 33 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

Emit additional command output to stdout.

Type: boolean
--resultsdir RESULTSDIR
Optional

Output directory for code coverage and JUnit results; defaults to the deploy ID.

Type: directory
--coverageformatters COVERAGEFORMATTERS
Optional

Format of the code coverage results.

Type: array
--junit
Optional

Output JUnit test results.

Type: boolean

force:source:ignored:list (Deprecated)

Check your local project package directories for forceignored files.

As of April 13, 2023, this command is deprecated and we no longer update this topic.

Don't worry, this command and its flags continue to work the same as before, and any scripts that use the command won’t break. However, we recommend that you start using the equivalent sf-style project list ignored command instead. Here’s how the flags changed between the old and new commands; if a flag isn't listed, the old and new names are the same:

  • Removed flag: --loglevel
  • Changed flag name: Old name --sourcepath. New name: --source-dir.

For background information about this change, read this blog post, which describes how we've updated many of the existing sfdx commands to use the improvements we made in sf. We improved this particular command on April 13, 2023.

Warning

Command Syntax

sfdx force:source:ignored:list
[--json]
[--loglevel LOGLEVEL]
[-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/.sf/sf.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
-p | --sourcepath SOURCEPATH
Optional

File or directory of files that the command checks for foreceignored files.

Type: filepath

force:source:manifest:create (Deprecated)

Create a project manifest that lists the metadata components you want to deploy or retrieve .

As of April 13, 2023, this command is deprecated and we no longer update this topic.

Don't worry, this command and its flags continue to work the same as before, and any scripts that use the command won’t break. However, we recommend that you start using the equivalent sf-style project generate manifest command instead. Here’s how the flags changed between the old and new commands; if a flag isn't listed, the old and new names are the same:

  • Removed flag: --loglevel
  • Changed flag name: Old name --apiversion. New name: --api-version.
  • Changed flag name: Old name --fromorg. New name: --from-org.
  • Changed flag name: Old name --includepackages. New name: --include-packages.
  • Changed flag name: Old name --manifestname. New name: --name.
  • Changed flag name: Old name --manifesttype. New name: --type.
  • Changed flag name: Old name --outputdir. New name: --output-dir.
  • Changed flag name: Old name --sourcepath. New name: --source-dir.

For background information about this change, read this blog post, which describes how we've updated many of the existing sfdx commands to use the improvements we made in sf. We improved this particular command on April 13, 2023.

Warning

Help for force:source:manifest:create

Create a manifest from a list of metadata components (--metadata) or from one or more local directories that contain source files (--sourcepath). You can specify either of these parameters, not both.

Use --manifesttype to specify the type of manifest you want to create. The resulting manifest files have specific names, such as the standard package.xml or destructiveChanges.xml to delete metadata. Valid values for this parameter, and their respective file names, are:

package : package.xml (default)

pre : destructiveChangesPre.xml

post : destructiveChangesPost.xml

destroy : destructiveChanges.xml

See https://developer.salesforce.com/docs/atlas.en-us.api_meta.meta/api_meta/meta_deploy_deleting_files.htm for information about these destructive manifest files.

Use --manifestname to specify a custom name for the generated manifest if the pre-defined ones don’t suit your needs. You can specify either --manifesttype or --manifestname, but not both.

Examples for force:source:manifest:create

1sfdx force:source:manifest:create -m ApexClass
1sfdx force:source:manifest:create -m ApexClass:MyApexClass --manifesttype destroy
1sfdx force:source:manifest:create --sourcepath force-app --manifestname myNewManifest
1sfdx force:source:manifest:create --fromorg test@myorg.com --includepackages unlocked

Command Syntax

sfdx force:source:manifest:create
[--json]
[--loglevel LOGLEVEL]
[--apiversion APIVERSION]
[-m METADATA]
[-p SOURCEPATH]
[-n MANIFESTNAME]
[-t MANIFESTTYPE]
[-c INCLUDEPACKAGES]
[--fromorg FROMORG]
[-o 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/.sf/sf.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, TRACE, DEBUG, INFO, WARN, ERROR, FATAL
Default value: warn
--apiversion APIVERSION
Optional

Override the API version used for API requests made by this command.

Type: string
-m | --metadata METADATA
Optional

Comma-separated list of names of metadata components to include in the manifest.

Type: array
-p | --sourcepath SOURCEPATH
Optional

Comma-separated list of paths to the local source files to include in the manifest.

Type: array
-n | --manifestname MANIFESTNAME
Optional

Name of a custom manifest file to create.

Type: string
-t | --manifesttype MANIFESTTYPE
Optional

Type of manifest to create; the type determines the name of the created file.

Type: enum
Permissible values are: pre, post, destroy, package
-c | --includepackages INCLUDEPACKAGES
Optional

Comma-separated list of package types (managed, unlocked) whose metadata is included in the manifest; by default, metadata in packages is ignored.

Type: array
--fromorg FROMORG
Optional

Username or alias of the org that contains the metadata components from which to build a manifest.

Type: string
-o | --outputdir OUTPUTDIR
Optional

Directory to save the created manifest.

Type: string

force:source:open (Deprecated)

Edit a Lightning Page with Lightning App Builder.

As of March 23, 2023, this command is deprecated and we no longer update this topic.

Don't worry, this command and its flags continue to work the same as before, and any scripts that use the command won’t break. However, we recommend that you start using the equivalent sf-style org open --source-file command instead. Here’s how the flags changed between the old and new commands; if a flag isn't listed, the old and new names are the same:

  • Removed flag: --loglevel
  • Changed flag name: Old name --apiversion. New name: --api-version.
  • Changed flag name: Old name --targetusername. New name: --target-org, with new short name -o.
  • Changed flag name: Old name --sourcefile. New name: --source-file.
  • Changed flag name: Old name --urlonly. New name: --url-only.

Here's an example to help you update your old commands. This sfdx-style command:

1sfdx force:source:open --source-file force-app/main/default/flexipages/Hello.flexipage-meta.xml --urlonly --targetusername myscratch

Looks like this using the equivalent sf-style command:

1sf org open --source-path force-app/main/default/flexipages/Hello.flexipage-meta.xml --url-only --target-org myscratch

For background information about this change, read this blog post, which describes how we've updated many of the existing sfdx commands to use the improvements we made in sf. We improved this particular command on March 23, 2023.

Warning

Help for force: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 Visualforce page, which has a .page suffix, the page opens in your browser so you can preview it. If you specify a different type of file, this command opens your org’s home page.

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 for force:source:open

1sfdx force:source:open -f path/to/source
1sfdx force:source:open -r -f path/to/source
1sfdx force:source:open -f path/to/source -u my-user@my-org.com

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/.sf/sf.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, 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; don’t launch the editor.

Type: boolean

force:source:pull (Deprecated)

Pull source from the scratch org to the project.

As of April 13, 2023, this command is deprecated and we no longer update this topic.

Don't worry, this command and its flags continue to work the same as before, and any scripts that use the command won’t break. However, we recommend that you start using the equivalent sf-style project retrieve start command instead.

With the new command, you must specify what you want to retrieve: either a source directory, metadata, or a manifest.

Use this table to map the flags between the old and new commands.

force:source:pull Flag Equivalent project retrieve start Flag Notes
-f, --forceoverwrite -c, --ignore-conflicts Note the new long and short flag names.
-u, --targetusername -o, --target-org Note the new short flag name.
-w, --wait -w, --wait
--apiversion -a, --api-version
--json --json
--loglevel No equivalent.

Here's an example to help you update your old commands. This sfdx-style command:

1sfdx force:source:pull --targetusername myscratch --forceoverwrite --wait 10

Looks like this using the equivalent sf-style command:

1sf project retrieve start --target-org myscratch --ignore-conflicts --wait 10 --source-dir path/to/source/objects

For background information about this change, read this blog post, which describes how we've updated many of the existing sfdx commands to use the improvements we made in sf. We improved this particular command on April 13, 2023.

Warning

Help for force: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.

Command Syntax

sfdx force:source:pull
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-f]
[-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/.sf/sf.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, 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

Ignore conflict warnings and overwrite changes to the project.

Type: boolean
-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 minutes

Aliases for force:source:pull

1force:source:beta:pull

force:source:push (Deprecated)

Push source to a scratch org from the project.

As of April 13, 2023, this command is deprecated and we no longer update this topic.

Don't worry, this command and its flags continue to work the same as before, and any scripts that use the command won’t break. However, we recommend that you start using the equivalent sf-style project deploy start command instead.

The project deploy start command works a bit differently from force:source:push. For example, you must specify what you want to deploy: either a source directory, metadata, or a manifest. Also, the project deploy start command doesn't support the pushPackageDirectoriesSequentially property of sfdx-project.json. The force:source:push command uses this property to deploy packages sequentially. If you need to deploy packages sequentially and in a specific order, use multiple project deploy start commands in the desired order.

Use this table to map the flags between the old and new commands.

force:source:push Flag Equivalent project retrieve start Flag Notes
-f, --forceoverwrite -c, --ignore-conflicts Note the new long and short flag names.
-g, --ignorewarnings -g, --ignore-warnings Note the new long and short flag names.
-u, --targetusername -o, --target-org Note the new short flag name.
-w, --wait -w, --wait
--apiversion -a, --api-version
--json --json
--loglevel No equivalent.
--quiet No equivalent.

Here's an example to help you update your old commands. This sfdx-style command:

1sfdx force:source:push --targetusername myscratch --forceoverwrite --wait 10

Looks like this using the equivalent sf-style command:

1sf project deploy start --target-org myscratch --ignore-conflicts --wait 10 --source-dir path/to/source/objects

For background information about this change, read this blog post, which describes how we've updated many of the existing sfdx commands to use the improvements we made in sf. We improved this particular command on April 13, 2023.

Warning

Help for force: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.

Command Syntax

sfdx force:source:push
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-f]
[-w WAIT]
[-g]
[--quiet]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sf/sf.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, 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
-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 minutes
-g | --ignorewarnings
Optional

Completes the deployment even if warnings are generated.

Type: boolean
--quiet
Optional

Command does not output to stdout.

Type: boolean

Aliases for force:source:push

1force:source:beta:push

force:source:retrieve (Deprecated)

Retrieve source from an org .

As of April 13, 2023, this command is deprecated and we no longer update this topic.

Don't worry, this command and its flags continue to work the same as before, and any scripts that use the command won’t break. However, we recommend that you start using the equivalent sf-style project retrieve start command instead.

Use this table to map the flags between the old and new commands. The mapping isn’t always one-to-one; see the Notes column for more information.

force:source:retrieve Flag Equivalent project retrieve start Flag Notes
-f, --forceoverwrite -c, --ignore-conflicts Note the new long and short flag name.
-x, --manifest -x, --manifest
-m, --metadata -m, --metadata
-n, --packagenames -n, --package-name
-r, --retrievetargetdir No equivalent.
-p, --sourcepath -d, --source-dir Note the new short flag name.
-u, --targetusername -o, --target-org Note the new short flag name.
-t, --tracksource No equivalent. The project retrieve start command always keeps track of your source if the org is enabled for source-tracking. If you don't want to use source tracking, create an org that doesn't have source tracking enabled.
-w, --wait -w, --wait
--apiversion -a, --api-version
--json --json
--loglevel No equivalent.
--verbose --verbose

Here are some examples to help you update your old commands. This sfdx-style command:

1sfdx force:source:retrieve --metadata "ApexClass,CustomObject" --targetusername my-scratch

Looks like this using the equivalent sf-style command:

1sf project retrieve start --metadata ApexClass --metadata CustomObject --target-org my-scratch

This sfdx-style command:

1sfdx force:source:retrieve --packagenames MyPackage --manifest package.xml

Looks like this using the equivalent sf-style command:

1sf project retrieve start --package-name MyPackage --manifest package.xml

This sfdx-style command:

1sfdx force:source:retrieve --sourcepath "path/to/objects/MyCustomObject/fields/MyField.field-meta.xml, path/to/apex/classes"

Looks like this using the equivalent sf-style command:

1sf project retrieve start --source-dir path/to/objects/MyCustomObject/fields/MyField.field-meta.xml --source-dir path/to/apex/classes

For background information about this change, read this blog post, which describes how we've updated many of the existing sfdx commands to use the improvements we made in sf. We improved this particular command on April 13, 2023.

Warning

Help for force:source:retrieve

Use this command to retrieve source (metadata that’s in source format) from an org.

To take advantage of change tracking with scratch orgs, use "sfdx force:source:pull".

To retrieve metadata that’s in metadata 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. On Windows, if the list contains commas, also enclose it in one set of double quotes.

Examples for force:source:retrieve

To retrieve the source files in a directory:

1sfdx force:source:retrieve -p path/to/source

To retrieve a specific Apex class and the objects whose source is in a directory:

1sfdx force:source:retrieve -p "path/to/apex/classes/MyClass.cls,path/to/source/objects"

To retrieve source files in a comma-separated list that contains spaces:

1sfdx force:source:retrieve -p "path/to/objects/MyCustomObject/fields/MyField.field-meta.xml, path/to/apex/classes"

To retrieve all Apex classes:

1sfdx force:source:retrieve -m ApexClass

To retrieve a specific Apex class:

1sfdx force:source:retrieve -m ApexClass:MyApexClass

To retrieve a specific Apex class and update source tracking files:

1sfdx force:source:retrieve -m ApexClass:MyApexClass -t

To retrieve all custom objects and Apex classes:

1sfdx force:source:retrieve -m "CustomObject,ApexClass"

To retrieve all Apex classes and two specific profiles (one of which has a space in its name):

1sfdx force:source:retrieve -m "ApexClass, Profile:My Profile, Profile: AnotherProfile"

To retrieve all metadata components listed in a manifest:

1sfdx force:source:retrieve -x path/to/package.xml

To retrieve metadata from a package or multiple packages:

1sfdx force:source:retrieve -n MyPackageName
1sfdx force:source:retrieve -n "Package1, PackageName With Spaces, Package3"

To retrieve all metadata from a package and specific components that aren’t in the package, specify both -n | --packagenames and one other scoping parameter:

1sfdx force:source:retrieve -n MyPackageName -p path/to/apex/classes
1sfdx force:source:retrieve -n MyPackageName -m ApexClass:MyApexClass
1sfdx force:source:retrieve -n MyPackageName -x path/to/package.xml

To retrieve source files to a given directory instead of the default package directory specified in sfdx-project.json:

1sfdx force:source:retrieve -m "StandardValueSet:TaskStatus" -r path/to/unpackaged

Command Syntax

sfdx force:source:retrieve
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[-a APIVERSION]
[-r RETRIEVETARGETDIR]
[-p SOURCEPATH]
[-w WAIT]
[-x MANIFEST]
[-m METADATA]
[-n PACKAGENAMES]
[-t]
[-f]
[--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/.sf/sf.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, 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

Override the API version used for API requests made by this command.

Type: string
-r | --retrievetargetdir RETRIEVETARGETDIR
Optional

The root of the directory structure into which the source files are retrieved.

If the target directory matches one of the package directories in your sfdx-project.json file, the command fails.

Running the command multiple times with the same target adds new files and overwrites existing files.

Type: directory
-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).

If you specify this parameter, don’t specify --manifest or --metadata.

Type: array
-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.

Type: minutes
Default value: 33 minutes
-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.

If you specify this parameter, don’t specify --manifest or --sourcepath.

Type: array
-n | --packagenames PACKAGENAMES
Optional

A comma-separated list of packages to retrieve.

Type: array
-t | --tracksource
Optional

If the retrieve succeeds, update source tracking information; doesn't delete local files that were deleted in the org.

Type: boolean
-f | --forceoverwrite
Optional

Ignore conflict warnings and overwrite changes to the project.

Type: boolean
--verbose
Optional

Emit additional command output to stdout.

Type: boolean

force:source:status (Deprecated)

List local changes and/or changes in a scratch org.

As of April 13, 2023, this command is deprecated and we no longer update this topic.

Don't worry, this command and its flags continue to work the same as before, and any scripts that use the command won’t break. However, we recommend that you start using the equivalent sf-style commands instead.

We found that this command (force:source:status), which shows either the local and remote changes, not very intuitive. So instead we now provide two separate commands to preview what a deploy or a retrieve will do:

These preview commands have the same flags as their non-preview commands, such as project deploy start

Use this table to map the flags between the old and new commands.

force:source:status Flag Equivalent project deploy preview or project retrieve preview Flag Notes
-l, --local No equivalent. We now provide two separate commands to preview what a deploy or a retrieve will do, which is more intuitive.
-r, --remote No equivalent We now provide two separate commands to preview what a deploy or a retrieve will do, which is more intuitive.
-u, --targetusername -o, --target-org Note the new short and long flag name.
--apiversion -a, --api-version
--concise No equivalent.
--json --json
--loglevel No equivalent.

Here's an example to help you update your old commands. This sfdx-style command:

1sfdx force:source:status --targetusername --remote

Looks like this using the equivalent sf-style command:

1sf project retrieve preview --target-org myscratch --source-dir path/to/source/objects

For background information about this change, read this blog post, which describes how we've updated many of the existing sfdx commands to use the improvements we made in sf. We improved this particular command on April 13, 2023.

Warning

Examples for force:source:status

1sfdx force:source:status -l
1sfdx force:source:status -r
1sfdx force:source:status
1sfdx force:source:status -u me@example.com --json

Command Syntax

sfdx force:source:status
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-l]
[-r]
[--concise]

Parameters

--json
Optional

Format output as JSON.

Type: boolean
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sf/sf.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, 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
-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
--concise
Optional

Emit brief command output to stdout.

Type: boolean

Aliases for force:source:status

1force:source:beta:status

force:source:tracking:clear (Deprecated)

Clear all local source tracking information.

As of April 13, 2023, this command is deprecated and we no longer update this topic.

Don't worry, this command and its flags continue to work the same as before, and any scripts that use the command won’t break. However, we recommend that you start using the equivalent sf-style project delete tracking command instead. Here’s how the flags changed between the old and new commands; if a flag isn't listed, the old and new names are the same:

  • Removed flag: --loglevel
  • Changed flag name: Old name --apiversion. New name: --api-version.
  • Changed flag name: Old name --targetusername. New name: --target-org, with new short name -o.
  • Changed flag name: Old name --noprompt. New name: --no-prompt.

For background information about this change, read this blog post, which describes how we've updated many of the existing sfdx commands to use the improvements we made in sf. We improved this particular command on April 13, 2023.

Warning

Help for force:source:tracking:clear

WARNING: This command deletes or overwrites all existing source tracking files. Use with extreme caution.

Clears all local source tracking information. When you next run force:source:status, the CLI displays all local and remote files as changed, and any files with the same name are listed as conflicts.

Command Syntax

sfdx force:source:tracking:clear
[--json]
[--loglevel LOGLEVEL]
[-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/.sf/sf.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, 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 source tracking override confirmation.

Type: boolean

Aliases for force:source:tracking:clear

1force:source:beta:tracking:clear

force:source:tracking:reset (Deprecated)

Reset local and remote source tracking.

As of April 13, 2023, this command is deprecated and we no longer update this topic.

Don't worry, this command and its flags continue to work the same as before, and any scripts that use the command won’t break. However, we recommend that you start using the equivalent sf-style project reset tracking command instead. Here’s how the flags changed between the old and new commands; if a flag isn't listed, the old and new names are the same:

  • Removed flag: --loglevel
  • Changed flag name: Old name --apiversion. New name: --api-version.
  • Changed flag name: Old name --targetusername. New name: --target-org, with new short name -o.
  • Changed flag name: Old name --noprompt. New name: --no-prompt.

For background information about this change, read this blog post, which describes how we've updated many of the existing sfdx commands to use the improvements we made in sf. We improved this particular command on April 13, 2023.

Warning

Help for force:source:tracking:reset

WARNING: This command deletes or overwrites all existing source tracking files. Use with extreme caution.

Resets local and remote source tracking so that the CLI no longer registers differences between your local files and those in the org. When you next run force:source:status, the CLI returns no results, even though conflicts might actually exist. The CLI then resumes tracking new source changes as usual.

Use the --revision parameter to reset source tracking to a specific revision number of an org source member. To get the revision number, query the SourceMember Tooling API object with the force:data:soql:query command. For example:

1sfdx force:data:soql:query -q "SELECT MemberName, MemberType, RevisionCounter FROM SourceMember" -t

Command Syntax

sfdx force:source:tracking:reset
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-r REVISION]
[-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/.sf/sf.log.

Type: enum
Permissible values are: trace, debug, info, warn, error, fatal, 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 | --revision REVISION
Optional

Reset to a specific SourceMember revision counter number.

Type: integer
-p | --noprompt
Optional

Do not prompt for source tracking override confirmation.

Type: boolean

Aliases for force:source:tracking:reset

1force:source:beta:tracking:reset