package Commands

Use the package commands to develop and install packages.

force:package:create

Creates a package.

Help for force:package:create

First, use this command to create a package. Then create a package version.

If you don’t have a namespace defined in your sfdx-project.json file, use --nonamespace.

Your --name value must be unique within your namespace.

Examples:

1$ sfdx force:package:create -n YourPackageName -t Unlocked -r force-app
1$ sfdx force:package:create -n YourPackageName -d "Your Package Descripton" -t Unlocked -r force-app

Run 'sfdx force:package:list' to list all packages in the Dev Hub org.

Command Syntax

sfdx force:package:create
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[--apiversion APIVERSION]
-n NAME
-t PACKAGETYPE
[-d DESCRIPTION]
[-e]
-r PATH
[--orgdependent]
[-o ERRORNOTIFICATIONUSERNAME]

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

Package type for the package.

The options for package type are Managed and Unlocked (Managed=DeveloperManagedSubscriberManaged, Unlocked=DeveloperControlledSubscriberEditable).

These options determine upgrade and editability rules.

Type: enum
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
--orgdependent
Optional

Package depends on unpackaged metadata in the installation org. Applies to unlocked packages only. (Beta)

Use Source Tracking in Sandboxes (Beta), to develop your org-dependent unlocked package.

Type: boolean
-o | --errornotificationusername ERRORNOTIFICATIONUSERNAME
Optional

An active Dev Hub org user designated to receive email notifications for unhandled Apex exceptions, and install, upgrade, or uninstall failures associated with your package.

Type: string

force:package:delete

Delete unlocked and second-generation managed packages. Before you delete a package, first delete all associated package versions.

Help for force:package:delete

Specify the ID or alias of the package you want to delete.

Examples:

1$ sfdx force:package:delete -p "Your Package Alias"
1$ sfdx force:package:delete -p 0Ho...

Command Syntax

sfdx force:package:delete
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[--apiversion APIVERSION]
[-n]
-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: enum
Permissible values are: trace, debug, info, warn, error, fatal, 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 | --noprompt
Optional

don’t prompt before deleting the package

Type: boolean
-p | --package PACKAGE
Required

The ID (starts with 0Ho) or alias of the package to delete.

Type: string

force:package:hammertest:list (Pilot)

Lists the statuses of running and completed ISV Hammer tests.

We provide the force:package:hammertest:list command to selected customers through a pilot program that requires agreement to specific terms and conditions. To be nominated to participate in the program, contact Salesforce. Pilot programs are subject to change, and we can’t guarantee acceptance. The force:package:hammertest: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 force:package:hammertest:list command in the ISV Hammer - Pilot group in the Trailblazer Community.

Note

Help for force:package:hammertest:list

If you supply a --packageversionid value, this command returns test statuses for only the tests associated with the specified package version. If you don’t include the --packageversionid parameter, the command lists all test statuses.

Examples:

1$ sfdx force:package:hammertest:list -u you@yourpackagingorg.com -i 04t...
1$ sfdx force:package:hammertest:list -u you@yourpackagingorg.com

Command Syntax

sfdx force:package:hammertest:list
[--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: 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
-i | --packageversionid PACKAGEVERSIONID
Optional

The ID of the package version to list test results for (starts with 04t).

Type: id

force:package:hammertest:report (Pilot)

Returns the status of a running ISV Hammer test or the results of a completed hammer test.

We provide the force:package:hammertest:report command to selected customers through a pilot program that requires agreement to specific terms and conditions. To be nominated to participate in the program, contact Salesforce. Pilot programs are subject to change, and we can’t guarantee acceptance. The force:package:hammertest:report 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 force:package:hammertest:report command in the ISV Hammer - Pilot group in the Trailblazer Community.

Note

Help for force:package:hammertest:report

Example:

1$ sfdx force:package:hammertest:report -u you@yourpackagingorg.com -i 0TW...

Command Syntax

sfdx force:package:hammertest:report
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
-i REQUESTID
[-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: 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
-i | --requestid REQUESTID
Required

The ID of the ISV Hammer request to return the status or results for (starts with 0TW).

To list your hammer request IDs, run "sfdx force:package:hammertest:list".

Type: id
-s | --summary
Optional

Hides Apex test failures, reporting only a results summary.

Type: boolean

force:package:hammertest:run (Pilot)

Runs ISV Hammer for the specified package version and subscriber orgs.

We provide the force:package:hammertest:run command to selected customers through a pilot program that requires agreement to specific terms and conditions. To be nominated to participate in the program, contact Salesforce. Pilot programs are subject to change, and we can’t guarantee acceptance. The force:package:hammertest:run 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 force:package:hammertest:run command in the ISV Hammer - Pilot group in the Trailblazer Community.

Note

Help for force:package:hammertest:run

Use this command to run ISV Hammer for the specified package versions and subscriber orgs.

If Salesforce has enabled Multiple Managed Packages for your org, you can test more than one package version. Supply the IDs of the package versions you want to test in the desired order of execution.

The command creates a copy of each of the supplied subscriber orgs and tests the package upgrade in each of them.

If a scheduled date/time is supplied, validation and setup start immediately but the package upgrade test will not start until after the supplied date/time. Format the --scheduledrundatetime value as YYYY-MM-DD HH:mm:ss in the GMT timezone. This date cannot be more than 25 days from today.

To test against the Salesforce preview release version, during the sandbox preview window, include --preview and a --scheduledrundatetime value that’s immediately after a staggered release, based on the Salesforce release calendar.

To run the package version’s Apex tests in each subscriber org after successfully testing the package upgrade, include --apextests.

The command returns a request ID (starts with 0TW). Use this IsvHammerRequest ID to query for the test status by running "sfdx force:package:hammertest:report -i 0TW...".

Examples:

1$ sfdx force:package:hammertest:run -u you@yourpackagingorg.com -i "04t...a,04t...b" -s "00D...a,00Dx...b"
1$ sfdx force:package:hammertest:run -u you@yourpackagingorg.com -i 04t... -f subscriberOrgs.txt

Command Syntax

sfdx force:package:hammertest:run
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
-i PACKAGEVERSIONIDS
[-s SUBSCRIBERORGS]
[-f SUBSCRIBERFILE]
[-d SCHEDULEDRUNDATETIME]
[-p]
[-t]
[-n APEXTESTINTERFACE]

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: 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
-i | --packageversionids PACKAGEVERSIONIDS
Required

A comma-separated list of one or more package version IDs to upgrade or install (each starts with 04t). You can include more than one package version ID only if Salesforce has enabled Multiple Managed Packages for your org. The order of the list specifies the order of the upgrades or installations.

Type: array
-s | --subscriberorgs SUBSCRIBERORGS
Optional

A comma-separated list of one or more subscriber org IDs (each starts with 00D) to run the hammer test on. Either -s or -f is required.

Type: array
-f | --subscriberfile SUBSCRIBERFILE
Optional

The path to a file containing a list of subscriber orgs IDs (each starts with 00D), one per line, to run the hammer test on. Either -s or -f required.

Type: string
-d | --scheduledrundatetime SCHEDULEDRUNDATETIME
Optional

The earliest date and time when the package upgrade test can run (in GMT, in the YYYY-MM-DD HH:mm:ss format).

Type: string
-p | --preview
Optional

Runs the package ISV Hammer test in the upcoming Salesforce preview version.

If you include this flag, include a --scheduledrundatetime value that’s immediately after a staggered release, based on the Salesforce release calendar.

Type: boolean
-t | --apextests
Optional

After successfully testing the package upgrade, runs the Apex tests in the package version in each subscriber org.

Type: boolean
-n | --apextestinterface APEXTESTINTERFACE
Optional

After package upgrade validation, runs the Apex tests in the subscriber org that implement an interface exposed from a managed package. The parameter value for interface name must be fully qualified.

Type: string

force:package:install

Installs a package in the target org.

Help for force:package:install

Supply the ID of the package version to install. The package installs in your default target org unless you supply the username for a different target org.

For package upgrades, to specify options for component deprecation or deletion of removed components, include an --upgradetype value. To delete components that can be safely deleted and deprecate the others, specify --upgradetype Mixed (the default). To deprecate all removed components, specify --upgradetype DeprecateOnly. To delete all removed components, except for custom objects and custom fields, that don't have dependencies, specify --upgradetype Delete. (Note: This option can result in the loss of data that is associated with the deleted components.) The default is Mixed.

Examples:

1$ sfdx force:package:install --package 04t... -u me@example.com
1$ sfdx force:package:install --package awesome_package_alias
1$ sfdx force:package:install --package "Awesome Package Alias"
1$ sfdx force:package:install --package 04t... -t DeprecateOnly

Command Syntax

sfdx force:package:install
[--json]
[--loglevel LOGLEVEL]
[-u TARGETUSERNAME]
[--apiversion APIVERSION]
[-w WAIT]
[-k INSTALLATIONKEY]
[-b PUBLISHWAIT]
[-r]
[-p PACKAGE]
[-a APEXCOMPILE]
[-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: 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

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
-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

Allows the following without an explicit confirmation response: 1) Remote Site Settings and Content Security Policy websites to send or receive data, and 2) --upgradetype Delete to proceed.

Type: boolean
-p | --package PACKAGE
Optional

The ID (starts with 04t) or alias of the package version to install.

Type: string
-a | --apexcompile APEXCOMPILE
Optional

Applies to unlocked packages only. Specifies whether to compile all Apex in the org and package, or only the Apex in the package.

Type: enum
Permissible values are: all, package
Default value: all
-s | --securitytype SECURITYTYPE
Optional

Security access type for the installed package.

Deprecation notice: The --securitytype parameter's default value will change from AllUsers to AdminsOnly in an upcoming release (v47.0 or later).

Type: enum
Permissible values are: AllUsers, AdminsOnly
Default value: AdminsOnly
-t | --upgradetype UPGRADETYPE
Optional

For package upgrades, specifies whether to mark all removed components as deprecated (DeprecateOnly), to delete removed components that can be safely deleted and deprecate the others (Mixed), or to delete all removed components, except for custom objects and custom fields, that don't have dependencies (Delete). The default is Mixed. Can specify DeprecateOnly or Delete only for unlocked package upgrades.

Type: enum
Permissible values are: DeprecateOnly, Mixed, Delete
Default value: Mixed

force:package:install:report

Retrieves the status of a package installation request.

Help for force:package:install:report

Examples:

1$ sfdx force:package:install:report -i 0Hf...
1$ sfdx force:package:install:report -i 0Hf... -u me@example.com

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: 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
-i | --requestid REQUESTID
Required

The ID of the package install request you want to check.

Type: id

force:package:installed:list

Lists all packages installed in the target org.

Help for force:package:installed:list

Examples:

1$ sfdx force:package:installed:list
1$ sfdx force:package:installed:list -u me@example.com

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: 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

force:package:list

Lists all packages in the Dev Hub org.

Help for force:package:list

You can view the namespace, IDs, and other details for each package.

Examples:

1$ sfdx force:package:list -v devhub@example.com
1$ sfdx force:package:list -v devhub@example.com --verbose

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

Type: boolean

force:package:uninstall

Uninstalls a second-generation package from the target org. To uninstall a first-generation package, use the Salesforce user interface.

Help for force:package:uninstall

Specify the package ID for a second-generation package.

Examples:

1$ sfdx force:package:uninstall -p 04t... -u me@example.com
1$ sfdx force:package:uninstall -p undesirable_package_alias
1$ sfdx force:package:uninstall -p "Undesirable Package Alias"

To list the org’s installed packages, run "sfdx force:package:installed:list".

To uninstall a first-generation package, from Setup, enter Installed Packages in the Quick Find box, then select Installed Packages.

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: 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

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

force:package:uninstall:report

Retrieves the status of a package uninstall request.

Help for force:package:uninstall:report

Examples:

1$ sfdx force:package:uninstall:report -i 06y...
1$ sfdx force:package:uninstall:report -i 06y... -u me@example.com

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
--loglevel LOGLEVEL
Optional

The logging level for this command invocation. Logs are stored in $HOME/.sfdx/sfdx.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
-i | --requestid REQUESTID
Required

The ID of the package uninstall request you want to check.

Type: id

force:package:update

Updates details about a package. Does not create a package version.

Help for force:package:update

Specify a new value for each option you want to update.

Examples:

1$ sfdx force:package:update -p "Your Package Alias" -n "New Package Name"
1$ sfdx force:package:update -p 0Ho... -d "New Package Description"

Run "sfdx force:package:list" to list all packages in the Dev Hub org.

Command Syntax

sfdx force:package:update
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[--apiversion APIVERSION]
-p PACKAGE
[-n NAME]
[-d DESCRIPTION]
[-o ERRORNOTIFICATIONUSERNAME]

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

An active Dev Hub org user designated to receive email notifications for unhandled Apex exceptions, and install, upgrade, or uninstall failures associated with your package.

Type: string

force:package:version:create

Creates a package version in the Dev Hub org.

Help for force:package:version:create

The package version is based on the package contents in the specified directory.

To retrieve details about a package version create request, including status and package version ID (04t), run "sfdx force:package:version:create:report -i 08c...".

We recommend specifying the --installationkey to protect the contents of your package and to prevent unauthorized installation of your package.

To list package version creation requests in the org, run "sfdx force:package:version:create:list".

Managed packages must use the --codecoverage option and meet the code coverage requirements to promote a version to released.

Starting in Winter ‘21, only unlocked package versions that have met the minimum 75% code coverage requirement can be promoted. Code coverage minimums aren’t enforced on org-dependent unlocked packages.

Examples:

1$ sfdx force:package:version:create -d common -k password123
1$ sfdx force:package:version:create -p "Your Package Alias" -k password123
1$ sfdx force:package:version:create -p 0Ho... -k password123
1$ sfdx force:package:version:create -d common -k password123 --skipvalidation

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]
[-c]
[--releasenotesurl RELEASENOTESURL]
[--postinstallurl POSTINSTALLURL]
[--postinstallscript POSTINSTALLSCRIPT]
[--uninstallscript UNINSTALLSCRIPT]
[--skipvalidation]

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: enum
Permissible values are: trace, debug, info, warn, error, fatal, 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
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
Default value: 0 minutes
-a | --versionname VERSIONNAME
Optional

The name of the package version to be created. Overrides the sfdx-project.json value.

Type: string
-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
-c | --codecoverage
Optional

Calculate and store the code coverage percentage by running the Apex tests included in this package version. Managed packages must use this option and meet the code coverage requirements to promote the version.

Type: boolean
--releasenotesurl RELEASENOTESURL
Optional

The release notes URL. This link is displayed in the package installation UI to provide release notes for this package version to subscribers.

Type: url
--postinstallurl POSTINSTALLURL
Optional

The post-install instructions URL. The contents of the post-installation instructions URL are displayed in the UI after installation of the package version.

Type: url
--postinstallscript POSTINSTALLSCRIPT
Optional

Applies to managed packages only. The post-install script name. The post-install script is an Apex class within this package that is run in the installing org after installations or upgrades of this package version.

Type: string
--uninstallscript UNINSTALLSCRIPT
Optional

Applies to managed packages only. The uninstall script name. The uninstall script is an Apex class within this package that is run in the installing org after uninstallations of this package.

Type: string
--skipvalidation
Optional

Skips validation of dependencies, package ancestors, and metadata during package version creation. Skipping validation reduces the time it takes to create a new package version, but you can promote only validated package versions. Skipping validation can suppress important errors that can surface at a later stage. You can specify skip validation or code coverage, but not both. Code coverage is calculated during validation.

Type: boolean

force:package:version:create:list

Lists all requests to create second-generation package versions in the Dev Hub org.

Help for force:package:version:create:list

Shows the details of each request to create a package version in the Dev Hub org.

All filter parameters are applied using the AND logical operator (not OR).

To get information about a specific request, run "sfdx force:package:version:create:report" and supply the request ID.

Examples:

1$ sfdx force:package:version:create:list
1$ sfdx force:package:version:create:list --createdlastdays 3
1$ sfdx force:package:version:create:list --status Error
1$ sfdx force:package:version:create:list -s InProgress
1$ sfdx force:package:version:create:list -c 3 -s Success

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.

Type: boolean
--loglevel LOGLEVEL
Optional

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

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

force:package:version:create:report

Retrieves details about a package version creation request in the Dev Hub org.

Help for force:package:version:create:report

Specify the request ID for which you want to view details. If applicable, the command displays errors related to the request.

Examples:

1$ sfdx force:package:version:create:report -i 08c...
1$ sfdx force:package:version:create:report -i 08c... -v devhub@example.com

To show all requests in the org, run "sfdx force:package:version:create:list".

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

force:package:version:delete

Delete unlocked and second-generation managed package versions.

Help for force:package:version:delete

Specify the ID or alias of the package version you want to delete.

Examples:

1$ sfdx force:package:version:delete -p "Your Package Alias"
1$ sfdx force:package:version:delete -p 04t...

Command Syntax

sfdx force:package:version:delete
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[--apiversion APIVERSION]
[-n]
-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: enum
Permissible values are: trace, debug, info, warn, error, fatal, 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 | --noprompt
Optional

don’t prompt before deleting the package version

Type: boolean
-p | --package PACKAGE
Required

The ID (starts with 04t) or alias of the package version to delete.

Type: string

force:package:version:displayancestry (Beta)

Displays the ancestry tree for a 2GP managed package version.

This release contains a beta version of the force:package:version:displayancestry command, which means it’s a high-quality feature with known limitations. The the force:package:version:displayancestry 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 force:package:version:displayancestry command in the Unlocked Packages and Managed 2GPs group in the Trailblazer Community.

Note

Help for force:package:version:displayancestry

Examples:

1$ sfdx force:package:version:displayancestry -p package_version_alias
1$ sfdx force:package:version:displayancestry -p package_version_alias --dotcode
1$ sfdx force:package:version:displayancestry -p OHo...
1$ sfdx force:package:version:displayancestry -p 04t...

Command Syntax

sfdx force:package:version:displayancestry
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[--apiversion APIVERSION]
-p PACKAGE
[--dotcode]
[--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: enum
Permissible values are: trace, debug, info, warn, error, fatal, 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 or alias of the package or package version to display ancestry for. If you specify a package ID (starts with 0Ho) or alias, the ancestor tree for every package version associated with the package ID is displayed.

If you specify a package version (starts with 04t) or alias, the ancestry tree of the specified package version is displayed.

Type: string
--dotcode
Optional

Displays the ancestry tree in DOT code. You can use the DOT code output in graph visualization software to create tree visualizations.

Type: boolean
--verbose
Optional

Displays both the package version ID (starts with 04t) and the version number (major.minor.patch.build) in the ancestry tree.

Type: boolean

force:package:version:list

Lists all package versions in the Dev Hub org.

Help for force:package:version:list

Displays details of each package version in the org.

Use --concise or --verbose to display limited or additional details, respectively.

All filter parameters are applied using the AND logical operator (not OR).

Examples:

1$ sfdx force:package:version:list --verbose --createdlastdays 3 --released --orderby PatchVersion
1$ sfdx force:package:version:list --packages 0Ho000000000000,0Ho000000000001 --released --modifiedlastdays 0
1$ sfdx force:package:version:list --released
1$ sfdx force:package:version:list --concise --modifiedlastdays 0
1$ sfdx force:package:version:list --concise -c 3 -r
1$ sfdx force:package:version:list --packages exp-mgr,exp-mgr-util --released --modifiedlastdays 0

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

force:package:version:promote

Promotes a package version to released status.

Help for force:package:version:promote

Supply the ID or alias of the package version you want to promote. Promotes the package version to released status.

Examples:

1$ sfdx force:package:version:promote -p 04t...
1$ sfdx force:package:version:promote -p awesome_package_alias
1$ sfdx force:package:version:promote -p "Awesome Package Alias"

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

Type: string
-n | --noprompt
Optional

Do not prompt to confirm setting the package version as released.

Type: boolean

force:package:version:report

Retrieves details about a package version in the Dev Hub org.

Help for force:package:version:report

Examples:

1$ sfdx force:package:version:report -p 04t...
1$ sfdx force:package:version:report -p "Your Package Alias"

To update package version values, run "sfdx force:package:version:update".

Command Syntax

sfdx force:package:version:report
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[--apiversion APIVERSION]
-p PACKAGE
[--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: enum
Permissible values are: trace, debug, info, warn, error, fatal, 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

force:package:version:update

Updates a second-generation package version in the Dev Hub org.

Help for force:package:version:update

Specify a new value for each option you want to update.

Examples:

1$ sfdx force:package:version:update -p "Your Package Alias" -k password123
1$ sfdx force:package:version:update -p 04t... -b master -t 'Release 1.0.7'
1$ sfdx force:package:version:update -p 04t... -e "New Package Version Description"

To display details about a package version, run "sfdx force:package:version:report".

Command Syntax

sfdx force:package:version:update
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[--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: enum
Permissible values are: trace, debug, info, warn, error, fatal, 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
-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