package Commands

Use the package commands to develop and install packages.

force:package:create

Create a package.

As of April 20, 2023, we no longer maintain this section of the command reference. Refer to the reference information about the sf-style commands instead, which we update regularly. We keep this reference information about the sfdx-style commands as-is for historical reference only.

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 package create 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. Use the SF_LOG_LEVEL environment variable instead.
  • Changed flag name: Old name --apiversion. New name: --api-version.
  • Changed flag name: Old name --errornotificationusername. New name: --error-notification-username.
  • Changed flag name: Old name --nonamespace. New name: --no-namespace.
  • Changed flag name: Old name --orgdependent. New name: --org-dependent.
  • Changed flag name: Old name --packagetype. New name: --package-type.
  • Changed flag name: Old name --targetdevhubusername. New name: --target-hub-org.

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 February 2, 2023.

Warning

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.

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

Examples for force:package:create

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

Use Source Tracking in Sandboxes to develop your org-dependent unlocked package.

For more information, see "Create Org-Dependent Unlocked Packages" in the Salesforce DX Developer Guide.

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

Aliases for force:package:create

force:package:delete

Delete a package.

As of April 20, 2023, we no longer maintain this section of the command reference. Refer to the reference information about the sf-style commands instead, which we update regularly. We keep this reference information about the sfdx-style commands as-is for historical reference only.

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 package delete 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. Use the SF_LOG_LEVEL environment variable instead.
  • Changed flag name: Old name --apiversion. New name: --api-version.
  • Changed flag name: Old name --noprompt. New name: --no-prompt.
  • Changed flag name: Old name --targetdevhubusername. New name: --target-hub-org.

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 February 2, 2023.

Warning

Help for force:package:delete

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

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

Examples for force:package:delete

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

Aliases for force:package:delete

force:package:install

Install a package in the target org.

As of April 20, 2023, we no longer maintain this section of the command reference. Refer to the reference information about the sf-style commands instead, which we update regularly. We keep this reference information about the sfdx-style commands as-is for historical reference only.

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 package install 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. Use the SF_LOG_LEVEL environment variable instead.
  • Changed flag name: Old name --apiversion. New name: --api-version.
  • Changed flag name: Old name --apexcompile. New name: --apex-compile.
  • Changed flag name: Old name --installationkey. New name: --installation-key.
  • Changed flag name: Old name --noprompt. New name: --no-prompt.
  • Changed flag name: Old name --publishwait. New name: --publish-wait.
  • Changed flag name: Old name --securitytype. New name: --security-type.
  • Changed flag name: Old name --targetusername. New name: --target-org, with new short name -o.
  • Changed flag name: Old name --upgradetype. New name: --upgrade-type.

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 February 2, 2023.

Warning

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 for force:package:install

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

Maximum number of minutes to wait for installation status. The default is 0.

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

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.

For package installs into production orgs, or any org that has Apex Compile on Deploy enabled, the platform compiles all Apex in the org after the package install or upgrade operation completes.

This approach assures that package installs and upgrades don’t impact the performance of an org, and is done even if --apexcompile package is specified.

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

Security access type for the installed package.

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

Aliases for force:package:install

force:package:install:report

Retrieve the status of a package installation request.

As of April 20, 2023, we no longer maintain this section of the command reference. Refer to the reference information about the sf-style commands instead, which we update regularly. We keep this reference information about the sfdx-style commands as-is for historical reference only.

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 package install report 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. Use the SF_LOG_LEVEL environment variable instead.
  • Changed flag name: Old name --apiversion. New name: --api-version.
  • Changed flag name: Old name --requestid. New name: --request-id.
  • Changed flag name: Old name --targetusername. New name: --target-org, with new short name -o.

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 February 2, 2023.

Warning

Examples for force:package:install:report

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

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

Type: id

Aliases for force:package:install:report

force:package:installed:list

List the org’s installed packages.

As of April 20, 2023, we no longer maintain this section of the command reference. Refer to the reference information about the sf-style commands instead, which we update regularly. We keep this reference information about the sfdx-style commands as-is for historical reference only.

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 package installed list 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. Use the SF_LOG_LEVEL environment variable instead.
  • 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.

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 February 2, 2023.

Warning

Examples for force:package:installed:list

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

Aliases for force:package:installed:list

force:package:list

List all packages in the Dev Hub org.

As of April 20, 2023, we no longer maintain this section of the command reference. Refer to the reference information about the sf-style commands instead, which we update regularly. We keep this reference information about the sfdx-style commands as-is for historical reference only.

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 package list 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. Use the SF_LOG_LEVEL environment variable instead.
  • Changed flag name: Old name --apiversion. New name: --api-version.
  • Changed flag name: Old name --targetdevhubusername. New name: --target-hub-org.

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 February 2, 2023.

Warning

Help for force:package:list

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

Examples for force:package:list

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

Aliases for force:package:list

force:package:uninstall

Uninstall a second-generation package from the target org.

As of April 20, 2023, we no longer maintain this section of the command reference. Refer to the reference information about the sf-style commands instead, which we update regularly. We keep this reference information about the sfdx-style commands as-is for historical reference only.

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 package uninstall 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. Use the SF_LOG_LEVEL environment variable instead.
  • 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.

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 February 2, 2023.

Warning

Help for force:package:uninstall

Specify the package ID for a second-generation package.

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.

Examples for force:package:uninstall

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

Maximum number of minutes to wait for uninstall status. The default is 0.

Type: minutes
Default value: 0 minutes
-p | --package PACKAGE
Required

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

Type: string

Aliases for force:package:uninstall

force:package:uninstall:report

Retrieve status of package uninstall request.

As of April 20, 2023, we no longer maintain this section of the command reference. Refer to the reference information about the sf-style commands instead, which we update regularly. We keep this reference information about the sfdx-style commands as-is for historical reference only.

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 package uninstall report 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. Use the SF_LOG_LEVEL environment variable instead.
  • Changed flag name: Old name --apiversion. New name: --api-version.
  • Changed flag name: Old name --requestid. New name: --request-id.
  • Changed flag name: Old name --targetusername. New name: --target-org, with new short name -o.

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 February 2, 2023.

Warning

Examples for force:package:uninstall:report

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

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

Type: id

Aliases for force:package:uninstall:report

force:package:update

Update package details.

As of April 20, 2023, we no longer maintain this section of the command reference. Refer to the reference information about the sf-style commands instead, which we update regularly. We keep this reference information about the sfdx-style commands as-is for historical reference only.

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 package update 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. Use the SF_LOG_LEVEL environment variable instead.
  • Changed flag name: Old name --apiversion. New name: --api-version.
  • Changed flag name: Old name --errornotificationusername. New name: --error-notification-username.
  • Changed flag name: Old name --targetdevhubusername. New name: --target-hub-org.

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 February 2, 2023.

Warning

Help for force:package:update

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

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

Examples for force:package:update

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

Aliases for force:package:update

force:package:version:create

Creates a package version in the Dev Hub org.

As of April 20, 2023, we no longer maintain this section of the command reference. Refer to the reference information about the sf-style commands instead, which we update regularly. We keep this reference information about the sfdx-style commands as-is for historical reference only.

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 package version create 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. Use the SF_LOG_LEVEL environment variable instead.
  • Changed flag name: Old name --apiversion. New name: --api-version.
  • Changed flag name: Old name --codecoverage. New name: --code-coverage.
  • Changed flag name: Old name --definitionfile. New name: --definition-file.
  • Changed flag name: Old name --installationkey. New name: --installation-key.
  • Changed flag name: Old name --installationkeybypass. New name: --installation-key-bypass.
  • Changed flag name: Old name --postinstallscript. New name: --post-install-script.
  • Changed flag name: Old name --postinstallurl. New name: --post-install-url.
  • Changed flag name: Old name --releasenotesurl. New name: --releasenotes-url.
  • Changed flag name: Old name --skipancestorcheck. New name: --skip-ancestor-check.
  • Changed flag name: Old name --skipvalidation. New name: --skip-validation.
  • Changed flag name: Old name --targetdevhubusername. New name: --target-hub-org.
  • Changed flag name: Old name --uninstallscript. New name: --uninstall-script.
  • Changed flag name: Old name --versiondescription. New name: --version-description.
  • Changed flag name: Old name --versionname. New name: --version-name.
  • Changed flag name: Old name --versionnumber. New name: --version-number.

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 February 2, 2023.

Warning

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 that you specify the --installationkey parameter 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".

To promote a package version to released, you must use the --codecoverage parameter. The package must also meet the code coverage requirements. This requirement applies to both managed and unlocked packages.

We don’t calculate code coverage for org-dependent unlocked packages, or for package versions that specify --skipvalidation.

Examples for force:package:version:create

Command Syntax

sfdx force:package:version:create
[--json]
[--loglevel LOGLEVEL]
[-v TARGETDEVHUBUSERNAME]
[--apiversion APIVERSION]
[-b BRANCH]
[-c]
[-f DEFINITIONFILE]
[-k INSTALLATIONKEY]
[-x]
[-p PACKAGE]
[-d PATH]
[--postinstallscript POSTINSTALLSCRIPT]
[--postinstallurl POSTINSTALLURL]
[--releasenotesurl RELEASENOTESURL]
[--skipancestorcheck]
[--skipvalidation]
[-t TAG]
[--uninstallscript UNINSTALLSCRIPT]
[-e VERSIONDESCRIPTION]
[-a VERSIONNAME]
[-n VERSIONNUMBER]
[-w WAIT]
[--language LANGUAGE]

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
-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
-b | --branch BRANCH
Optional

Name of the branch in your source control system that the package version is based on.

Type: string
-c | --codecoverage
Optional

Calculate and store the code coverage percentage by running the Apex tests included in this package version. Before you can promote and release a managed or unlocked package version, the Apex code must meet a minimum 75% code coverage requirement. We don’t calculate code coverage for org-dependent unlocked packages or for package versions that specify --skipvalidation.

Type: boolean
-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
-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
-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
--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
--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
--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
--skipancestorcheck
Optional

Override ancestry requirements, which allows you to specify a package ancestor that isn’t the highest released package version.

Type: boolean
--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
-t | --tag TAG
Optional

The package version’s tag.

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
-e | --versiondescription VERSIONDESCRIPTION
Optional

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

Type: string
-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
-w | --wait WAIT
Optional

The number of minutes to wait for the package version to be created.

Type: minutes
Default value: 0 minutes
--language LANGUAGE
Optional

The language for the package. Specify the language using a language code listed under "Supported Languages" in Salesforce Help.

If no language is specified, the language defaults to the language of the Dev Hub user who created the package.

Only applies to orgs running API version 57.0 or higher.

Type: string

Aliases for force:package:version:create

force:package:version:create:list

List package version creation requests.

As of April 20, 2023, we no longer maintain this section of the command reference. Refer to the reference information about the sf-style commands instead, which we update regularly. We keep this reference information about the sfdx-style commands as-is for historical reference only.

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 package version create list 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. Use the SF_LOG_LEVEL environment variable instead.
  • Changed flag name: Old name --apiversion. New name: --api-version.
  • Changed flag name: Old name --createdlastdays. New name: --created-last-days.
  • Changed flag name: Old name --targetdevhubusername. New name: --target-hub-org.

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 February 2, 2023.

Warning

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 for force:package:version:create:list

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

Aliases for force:package:version:create:list

force:package:version:create:report

Retrieve details about a package version creation request.

As of April 20, 2023, we no longer maintain this section of the command reference. Refer to the reference information about the sf-style commands instead, which we update regularly. We keep this reference information about the sfdx-style commands as-is for historical reference only.

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 package version create report 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. Use the SF_LOG_LEVEL environment variable instead.
  • Changed flag name: Old name --apiversion. New name: --api-version.
  • Changed flag name: Old name --packagecreaterequestid. New name: --package-create-request-id.
  • Changed flag name: Old name --targetdevhubusername. New name: --target-hub-org.

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 February 2, 2023.

Warning

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.

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

Examples for force:package:version:create:report

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

Aliases for force:package:version:create:report

force:package:version:delete

Delete a package version.

As of April 20, 2023, we no longer maintain this section of the command reference. Refer to the reference information about the sf-style commands instead, which we update regularly. We keep this reference information about the sfdx-style commands as-is for historical reference only.

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 package version delete 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. Use the SF_LOG_LEVEL environment variable instead.
  • Changed flag name: Old name --apiversion. New name: --api-version.
  • Changed flag name: Old name --noprompt. New name: --no-prompt.
  • Changed flag name: Old name --targetdevhubusername. New name: --target-hub-org.

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 February 2, 2023.

Warning

Help for force:package:version:delete

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

Examples for force:package:version:delete

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

Aliases for force:package:version:delete

force:package:version:displayancestry

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

As of April 20, 2023, we no longer maintain this section of the command reference. Refer to the reference information about the sf-style commands instead, which we update regularly. We keep this reference information about the sfdx-style commands as-is for historical reference only.

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 package version displayancestry 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. Use the SF_LOG_LEVEL environment variable instead.
  • Changed flag name: Old name --apiversion. New name: --api-version.
  • Changed flag name: Old name --dotcode. New name: --dot-code.
  • Changed flag name: Old name --targetdevhubusername. New name: --target-hub-org.

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 February 2, 2023.

Warning

Examples for force:package:version:displayancestry

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

Aliases for force:package:version:displayancestry

force:package:version:list

List all package versions in the Dev Hub org.

As of April 20, 2023, we no longer maintain this section of the command reference. Refer to the reference information about the sf-style commands instead, which we update regularly. We keep this reference information about the sfdx-style commands as-is for historical reference only.

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 package version list 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. Use the SF_LOG_LEVEL environment variable instead.
  • Changed flag name: Old name --apiversion. New name: --api-version.
  • Changed flag name: Old name --createdlastdays. New name: --created-last-days.
  • Changed flag name: Old name --modifiedlastdays. New name: --modified-last-days.
  • Changed flag name: Old name --orderby. New name: --order-by.
  • Changed flag name: Old name --targetdevhubusername. New name: --target-hub-org.

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 February 2, 2023.

Warning

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 for force:package:version:list

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

Aliases for force:package:version:list

force:package:version:promote

Promote a package version to released.

As of April 20, 2023, we no longer maintain this section of the command reference. Refer to the reference information about the sf-style commands instead, which we update regularly. We keep this reference information about the sfdx-style commands as-is for historical reference only.

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 package version promote 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. Use the SF_LOG_LEVEL environment variable instead.
  • Changed flag name: Old name --apiversion. New name: --api-version.
  • Changed flag name: Old name --noprompt. New name: --no-prompt.
  • Changed flag name: Old name --targetdevhubusername. New name: --target-hub-org.

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 February 2, 2023.

Warning

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 for force:package:version:promote

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

Aliases for force:package:version:promote

force:package:version:report

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

As of April 20, 2023, we no longer maintain this section of the command reference. Refer to the reference information about the sf-style commands instead, which we update regularly. We keep this reference information about the sfdx-style commands as-is for historical reference only.

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 package version report 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. Use the SF_LOG_LEVEL environment variable instead.
  • Changed flag name: Old name --apiversion. New name: --api-version.
  • Changed flag name: Old name --targetdevhubusername. New name: --target-hub-org.

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 February 2, 2023.

Warning

Help for force:package:version:report

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

Examples for force:package:version:report

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

Aliases for force:package:version:report

force:package:version:update

Update a package version.

As of April 20, 2023, we no longer maintain this section of the command reference. Refer to the reference information about the sf-style commands instead, which we update regularly. We keep this reference information about the sfdx-style commands as-is for historical reference only.

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 package version update 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. Use the SF_LOG_LEVEL environment variable instead.
  • Changed flag name: Old name --apiversion. New name: --api-version.
  • Changed flag name: Old name --installationkey. New name: --installation-key.
  • Changed flag name: Old name --targetdevhubusername. New name: --target-hub-org.
  • Changed flag name: Old name --versiondescription. New name: --version-description.
  • Changed flag name: Old name --versionname. New name: --version-name.

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 February 2, 2023.

Warning

Help for force:package:version:update

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

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

Examples for force:package:version:update

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

Aliases for force:package:version:update