package2 Commands (Pilot)

Use the package2 commands to create, install, and manage second-generation packages.

We provide Second-Generation Packaging 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. Second-Generation Packaging 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.

Note

package2:create (Pilot)

Creates a second-generation package.

Command Syntax

sfdx force:package2:create
-n NAME
[-d DESCRIPTION]
[-s NAMESPACE]
[-v TARGETDEVHUBUSERNAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-n | --name NAME
Required




Name of the package2 to create.

Type: string
-d | --description DESCRIPTION
Optional




Description of the package2.

Type: string
-s | --namespace NAMESPACE
Optional




Global namespace for the package2.

Type: string
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional




A username for the target Dev Hub org. Overrides default Dev Hub org.

Type: string
--json
Optional




Format output as JSON.

Type: flag
--loglevel LOGLEVEL
Optional




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

Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: error

Help for package2:create

This command must be run in a project.

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

Examples:

1$ sfdx force:package2:create --name PackageName --namespace MyNamespace --description 'My New Package'

Run 'sfdx force:package2:list' to list all package2 packages in the dev hub org.

package2:installed:list (Pilot)

Lists all subscriber package2 versions installed in the target org.

Command Syntax

sfdx force:package2:installed:list
[-u TARGETUSERNAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-u | --targetusername TARGETUSERNAME
Optional




Username for the target org. Overrides the default target org.

Type: string
--json
Optional




Format output as JSON.

Type: flag
--loglevel LOGLEVEL
Optional




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

Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: error

Help for package2:installed:list

This command must be run in a project.

Lists all subscriber package2 versions installed in the target org.

package2:list (Pilot)

Lists all second-generation packages in the Dev Hub org.

Command Syntax

sfdx force:package2:list
[-v TARGETDEVHUBUSERNAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional




A username for the target Dev Hub org. Overrides default Dev Hub org.

Type: string
--json
Optional




Format output as JSON.

Type: flag
--loglevel LOGLEVEL
Optional




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

Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: error

Help for package2:list

You can view the namespace, ID, and subscriber package2 ID for each package2.

package2:manifest:create (Pilot)

Creates a second-generation package manifest file in JSON format based on the files in the specified package2 source directory.

Command Syntax

sfdx force:package2:manifest:create
-d DIRECTORY
[-v TARGETDEVHUBUSERNAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-d | --directory DIRECTORY
Required




Directory for reading the package2 contents and generating the package2 manifest JSON file.

Type: directory
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional




A username for the target Dev Hub org. Overrides default Dev Hub org.

Type: string
--json
Optional




Format output as JSON.

Type: flag
--loglevel LOGLEVEL
Optional




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

Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: error

Help for package2:manifest:create

This command must be run in a project.

The manifest must be in the directory specified when you create a package2 version.

package2:members:list (Pilot)

Lists all subscriber package2 members in the target org.

Command Syntax

sfdx force:package2:members:list
[-u TARGETUSERNAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-u | --targetusername TARGETUSERNAME
Optional




Username for the target org. Overrides the default target org.

Type: string
--json
Optional




Format output as JSON.

Type: flag
--loglevel LOGLEVEL
Optional




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

Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: error

Help for package2:members:list

This command must be run in a project.

Lists the history of each package2 member: the package2 version when a member was first added (minimum), the latest package version that contains the member (current), and the latest version that contained any deleted members (maximum). The Subject Manageable State shows the state of the object referenced by the package2 member: beta, deleted, deprecated, installed, released, or unmanaged.

package2:version:create (Pilot)

Creates a second-generation package (package2) version in the Dev Hub org.

Command Syntax

sfdx force:package2:version:create
-i PACKAGE2ID
-d DIRECTORY
[-b BRANCH]
[-t TAG]
[-w WAIT]
[-v TARGETDEVHUBUSERNAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-i | --package2id PACKAGE2ID
Required




ID of parent package2 (starts with 0Ho).

Type: id
-d | --directory DIRECTORY
Required




The directory that contains the manifest, descriptor, and contents of the package2 version.

Type: directory
-b | --branch BRANCH
Optional




The package2 version's branch.

Type: string
-t | --tag TAG
Optional




The package2 version's tag.

Type: string
-w | --wait WAIT
Optional




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

Type: minutes
Default value: 0
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional




A username for the target Dev Hub org. Overrides default Dev Hub org.

Type: string
--json
Optional




Format output as JSON.

Type: flag
--loglevel LOGLEVEL
Optional




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

Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: error

Help for package2:version:create

This command must be run in a project.

The package2 version is based on the manifest, descriptor, and package2 contents in the specified directory.

To retrieve details about a package2 version create request, including status and package2 version id (05i), run "sfdx force:package2:version:create:get -i 08c...".

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

Examples:

1$ sfdx force:package2:version:create --package2id 0Ho... --directory common --tag 'Release 1.0.0' --branch master
1$ sfdx force:package2:version:create -i 0Ho... -d common

package2:version:create:get (Pilot)

Retrieves a second-generation package version creation request in the Dev Hub org.

Command Syntax

sfdx force:package2:version:create:get
-i PACKAGE2CREATEREQUESTID
[-v TARGETDEVHUBUSERNAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-i | --package2createrequestid PACKAGE2CREATEREQUESTID
Required




The ID of the package2 version creation request you want to display.

Type: id
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional




A username for the target Dev Hub org. Overrides default Dev Hub org.

Type: string
--json
Optional




Format output as JSON.

Type: flag
--loglevel LOGLEVEL
Optional




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

Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: error

Help for package2:version:create:get

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:package2:version:create:get --package2createrequestid 08c...

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

package2:version:create:list (Pilot)

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

Command Syntax

sfdx force:package2:version:create:list
[-c CREATEDLASTDAYS]
[-s STATUS]
[-v TARGETDEVHUBUSERNAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-c | --createdlastdays CREATEDLASTDAYS
Optional




Lists the requests made in the last specified number of days, starting at 00:00:00 of first day to now. Use 0 for today.

Type: number
-s | --status STATUS
Optional




Filters the list based on the status of version creation requests.

Type: string
Permissible values are: Queued, InProgress, Success, Error
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional




A username for the target Dev Hub org. Overrides default Dev Hub org.

Type: string
--json
Optional




Format output as JSON.

Type: flag
--loglevel LOGLEVEL
Optional




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

Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: error

Help for package2:version:create:list

Shows the details of each request to create a package2 version that's run 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:package2:version:create:get" and supply the request ID.

Examples:

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

package2:version:get (Pilot)

Retrieves a package version in the Dev Hub org

Command Syntax

sfdx force:package2:version:get
-i PACKAGE2VERSIONID
[-v TARGETDEVHUBUSERNAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-i | --package2versionid PACKAGE2VERSIONID
Required




The package2 version ID (starts with 05i).

Type: id
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional




A username for the target Dev Hub org. Overrides default Dev Hub org.

Type: string
--json
Optional




Format output as JSON.

Type: flag
--loglevel LOGLEVEL
Optional




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

Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: error

Help for package2:version:get

This command must be run in a project.

Examples:

1$ sfdx force:package2:version:get --package2versionid 05i...

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

package2:version:install (Pilot)

Installs a second-generation subscriber package version in the target org.

Command Syntax

sfdx force:package2:version:install
-i SUBSCRIBERPACKAGE2VERSIONID
[-u TARGETUSERNAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-i | --subscriberpackage2versionid SUBSCRIBERPACKAGE2VERSIONID
Required




The ID of the subscriber package2 version to install (starts with 04t).

Type: id
-u | --targetusername TARGETUSERNAME
Optional




Username for the target org. Overrides the default target org.

Type: string
--json
Optional




Format output as JSON.

Type: flag
--loglevel LOGLEVEL
Optional




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

Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: error

Help for package2:version:install

This command must be run in a project.

Installs a second-generation subscriber package version in the target org. To view the error messages, open the Dev Hub org, select the Setup menu, enter Deployment in the Quick Find box, and select Deployment Status.

Examples:

1$ sfdx force:package2:version:install --subscriberpackage2versionid 04t...
1$ sfdx force:package2:version:install -i 04t... -u <username of target org>

To find the ID for the subscriber package2 version, run "sfdx package2:version:list".

To list the org’s installed subscriber package2 versions, run "package2:installed:list".

package2:version:list (Pilot)

Lists all package2 versions in the Dev Hub org.

Command Syntax

sfdx force:package2:version:list
[-c CREATEDLASTDAYS]
[-m MODIFIEDLASTDAYS]
[-i PACKAGE2IDS]
[-r]
[-o ORDERBY]
[-v TARGETDEVHUBUSERNAME]
[--concise]
[--json]
[--loglevel LOGLEVEL]
[--verbose]

Parameters

-c | --createdlastdays CREATEDLASTDAYS
Optional




Lists the requests made in the last specified number of days, starting at 00:00:00 of first day to now. Use 0 for today.

Type: number
-m | --modifiedlastdays MODIFIEDLASTDAYS
Optional




Lists the items modified in the last given number of days, starting at 00:00:00 of first day to now. Use 0 for today.

Type: number
-i | --package2ids PACKAGE2IDS
Optional




Filters results on the specified comma-delimited package2 IDs (start with 0Ho).

Type: string
-r | --released
Optional




Displays released versions only (IsBeta=false).

Type: flag
-o | --orderby ORDERBY
Optional




Orders the list by the specified package2 version fields.

Type: string
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional




A username for the target Dev Hub org. Overrides default Dev Hub org.

Type: string
--concise
Optional




Displays limited package2 version details.

Type: flag
--json
Optional




Format output as JSON.

Type: flag
--loglevel LOGLEVEL
Optional




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

Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: error
--verbose
Optional




Display extended package2 versions detail.

Type: flag

Help for package2:version:list

Displays details of each package2 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:package2:version:list --verbose --createdlastdays 3 --released --orderby PatchVersion
1$ sfdx force:package2:version:list --package2ids 0Ho000000000000,0Ho000000000001 --released --modifiedlastdays 0
1$ sfdx force:package2:version:list --released
1$ sfdx force:package2:version:list --concise --modifiedlastdays 0
1$ sfdx force:package2:version:list --concise -c 3 -r

package2:version:uninstall (Pilot)

Uninstalls a subscriber package2 version in the target org.

Command Syntax

sfdx force:package2:version:uninstall
-i SUBSCRIBERPACKAGE2VERSIONID
[-u TARGETUSERNAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-i | --subscriberpackage2versionid SUBSCRIBERPACKAGE2VERSIONID
Required




The ID of the subscriber package2 version to uninstall (starts with 04t).

Type: id
-u | --targetusername TARGETUSERNAME
Optional




Username for the target org. Overrides the default target org.

Type: string
--json
Optional




Format output as JSON.

Type: flag
--loglevel LOGLEVEL
Optional




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

Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: error

Help for package2:version:uninstall

This command must be run in a project.

Specify the subscriber package2 version ID.

Examples:

1$ sfdx force:package2:version:uninstall --subscriberpackage2versionid 04t...
1$ sfdx force:package2:version:uninstall -i 04t... -u <username of target org>

To list the org’s installed subscriber package2 versions, run "package2:installed:list".

package2:version:update (Pilot)

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

Command Syntax

sfdx force:package2:version:update
-i PACKAGE2VERSIONID
[-n NAME]
[-d DESCRIPTION]
[-b BRANCH]
[-t TAG]
[-s]
[-v TARGETDEVHUBUSERNAME]
[--json]
[--loglevel LOGLEVEL]

Parameters

-i | --package2versionid PACKAGE2VERSIONID
Required




The package2 version ID (starts with 05i).

Type: id
-n | --name NAME
Optional




The package2 version name.

Type: string
-d | --description DESCRIPTION
Optional




The package2 version description.

Type: string
-b | --branch BRANCH
Optional




The package2 version branch.

Type: string
-t | --tag TAG
Optional




The package2 version tag.

Type: string
-s | --setasreleased
Optional




Sets the package2 version as released. Second-generation packages can’t be changed to beta after they've been released.

Type: flag
-v | --targetdevhubusername TARGETDEVHUBUSERNAME
Optional




A username for the target Dev Hub org. Overrides default Dev Hub org.

Type: string
--json
Optional




Format output as JSON.

Type: flag
--loglevel LOGLEVEL
Optional




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

Type: string
Permissible values are: trace, debug, info, warn, error, fatal
Default value: error

Help for package2:version:update

This command must be run in a project.

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

Examples:

1$ sfdx force:package2:version:update --package2versionid 05i... --setasreleased
1$ sfdx force:package2:version:update --i 05i... -b master -t 'Release 1.0.7'

To display details about a package2 version, run "sfdx package2:version:get".