Use the CLI to Upload a “Managed Beta” Version of Your Package

In this exercise, you will…

  • Use force:package1:version:list to see a list of Package Versions associated with your packaging org
  • Prepare to use the force:package1:version:create command
  • Use force:package1:version:create to upload a “Managed Beta” version of your package
  • View the newly uploaded Package Version in your packaging org

Use force:package1:version:list to see a list of Package Versions associated with your packaging org

Execute this command:

sfdx force:package1:version:list -u PkgOrg
Salesforce DX Command / Flags Description
force:package1:version:list Lists the versions for the specified package or all first-generation packages in the org.
-u (--targetusername) A username or alias for the target org. Overrides the default target org.

After executing the above, your terminal should look something like this:

Prepare to use the force:package1:version:create command

It can be a bit tricky to get the force:package1:version:create command right, so here is an alternative way of setting up the command that might be helpful.

Step 1 of 4: Create a new untitled file in VS Code

  1. Press command+shift+P (MacOS) or CTRL+SHIFT+P (Windows) to open the VS Code command pallete.
  2. In the search box, type “new unt”.
  3. Click the File: New Untitled File command.

Step 2 of 4: Copy this command to your clipboard

sfdx force:package1:version:create \
    -i YOUR_033_METADATAPACKAGE_ID \
    -n "Winter 2019" \
    -v "1.1" \
    -d "Managed beta release. Uploaded via the CLI" \
    -u PkgOrg \
    -w 15
Salesforce DX Command / Flags Description
force:package1:version:create Creates a first-generation package version in the release org.
-i (--packageid) ID of the metadata package (starts with 033) of which you’re creating a new version.
-n (--name) Package version name.
-v (--version) Package version in major.minor format, for example, 3.2.
-d (--description) Package version description.
-u (--targetusername) A username or alias for the target org. Overrides the default target org.
-w (--wait) Minutes to wait for the package version to be created. The default is 2 minutes.

Step 3 of 4: Paste the command into your new untitled file

Step 4 of 4: Copy the Metadata Package ID from the terminal and paste it into your command

  1. Copy the Metadata Package ID from the result of the force:package1:version:list command.
  2. Paste it as the value for the -i flag in the command you’re building.

Use force:package1:version:create to upload a “Managed Beta” version of your package

Copy your entire command and paste it in the terminal

  1. Copy from the untitled text document.
  2. Paste into the terminal.

After executing the above, your terminal should look something like this:

View the newly uploaded Package Version in your packaging org

Step 1 of 3: Open the “Versions” tab inside the “My Managed Package” setup detail page

  1. Make sure you’re on the Package Setup page for your managed package.
  2. Click on the Versions tab.

Step 2 of 3: Open the “1.1 (Beta 1)” Package Version detail page

  1. Click on the 1.1 (Beta 1) package version.

Step 3 of 3: View details of the Package Version that was uploaded from the CLI

  1. Observe that this Managed Beta package has all of the things you set from the CLI (version name, version number, and description).

Updated: