Start tracking your progress
Trailhead Home
Trailhead Home

Create a Packaging Org

Learning Objectives

  • Describe the elements needed for a managed package.
  • Create a packaging org.
  • Connect CumulusCI to your packaging org.

Create the Org

Important: Do not use your Trailhead Playground as your packaging org. In this unit, you’ll sign up for a Developer org to use for packaging.

A packaging org is a Developer Edition org configured with a managed package namespace. The packaging org is where new versions of the package are created. Every managed package has one and only one packaging org.

The first step is to create a new Developer Edition org. Fill out the Developer Edition form to get yours.

Note

Note

We really mean it about creating a Developer Edition org. Don’t try to use your Trailhead Playground as a packaging org. Why? The orgs have different purposes. We’re going to publish a new package from the Developer Edition (aka the packaging org), and later install it into your Trailhead Playground.

Once the org has been created, be sure to click through the email confirmation and set a password for your user.

Configure the Packaging Org

Before using CumulusCI to release the Food Bank managed package, Tasha needs to create the package and claim a namespace for it. Managed package namespaces are globally unique, and help make sure that component names from our package won’t collide with names from other customizations or another package.

Follow along as Tasha gets to work.

In the packaging org, create a new package:

  1. Click Gear iconand go to Setup.
  2. Use Quick Find to search for Package Manager.
  3. In Package Manager, click the New button in the Packages section to create a new package.
  4. Fill out the form with the following information:
    1. Package Name:Food-Bank
      Note: To make sure that CumulusCI will add components to the correct package, it’s important that the Package Name is the same as the name of the project in your cumulusci.yml file. You’d find this by looking under project, then package, then name. In Start a Community Project with CumulusCI, you set this name to be Food-Bank.
    2. Language: choose your language
    3. Configure Custom Link: leave as --None--
    4. Notify on Apex Error: leave blank
    5. Description: add information about your new package!
  5. Click Save.

Next, assign a namespace for the managed package. 

  1. In the Developer Settings panel on the Package Manager page in Setup, click Edit.
  2. Click Continue.
  3. Choose a namespace prefix. Keep these important considerations in mind:
    • Namespaces can only be used once throughout the Salesforce ecosystem. For this project, select a long, nonsensical name that wouldn’t be used for a real project.
    • Namespace prefixes can be up to 15 alphanumeric characters. Enter the prefix you’d like to claim and click the Check Availability button to see if it is available.
    • Make a note of the prefix for later.
  4. Once you have a valid prefix, choose your package in the Package to be managed dropdown.
  5. Click Review My Selections, then click Save.

In order to deploy this package to the packaging org, CumulusCI needs to know the name and namespace of the package. To set this up:

  1. In GitHub Desktop, open your repository in the VS Code by choosing Repository→Open in Visual Studio Code.
  2. In the Side Bar, click on the cumulusci.yml file to open it.
  3. Find the part of the file that looks like this:
project:
    name: Food-Bank
    package:
         name: Food-Bank
  1. Add a line to specify the package namespace:
project:
    name: Food-Bank
    package:
         name: Food-Bank
         namespace: myawesomenamespace
Note

Note

Be sure to type the actual package namespace that you assigned above, instead of myawesomenamespace!

Double-check that the package name is the same as what you entered for Package Name above. Press Command+s (macOS) or Ctrl+s (Windows) to save your changes to the cumulusci.yml file.

Let’s make sure that your changes are pushed to GitHub—you’ll need this in the next unit’s Hands-On Challenge! 

Open your repository in GitHub Desktop, then complete the following steps:

  1. Create a new feature branch to store the changes. In GitHub Desktop, choose Current Branch→New Branch, and name the branch feature/set-namespace. Choose to bring your changes to the new branch.
  2. In GitHub Desktop, on the feature/set-namespace feature branch, make a commit with the message Set package namespace.
  3. Publish the feature branch to GitHub by clicking Publish branch on the information pane that comes up after your commit is complete.
  4. When the information pane updates after publishing, click Create Pull Request to create a new Pull Request for this change.
  5. GitHub Desktop will automatically navigate you to the Open a pull request screen in your web browser.
  6. Under the header Changes, add a line to describe what you did.
  7. Click Create Pull Request.
  8. On the next screen, click Merge pull request. Click Confirm merge.
  9. Click Delete branch to remove the branch we just merged.

Connect the Org to CumulusCI

CumulusCI supports attaching existing Salesforce orgs to the project. To kick that process off:

  1. In GitHub Desktop, open your repository in the VS Code by choosing Repository→Open in Visual Studio Code.
  2. In the Terminal window, enter: cci org connect packaging

This command will open a Salesforce login page in your browser. Log in using the username and password for the org you created for your packaging org. After logging in, you'll be prompted to grant access to the org. Once you click Allow, you'll see “Congratulations! Your authentication succeeded.” in the browser.  

Return to the VS Code Terminal to confirm the org is now connected by entering this command: cci org list

It should display a table like this:

┌Connected Orgs───────┬───────────────────────┬──────────┐
│ Name     │ Default  │ Username              │Expires   │
├──────────┼──────────┼───────────────────────┼──────────┤
│packaging │          │ tasha@foodbankdev.org │Persistent│
└──────────┴──────────┴───────────────────────┴──────────┘

You can also directly open the packaging org anytime in the browser with this command in your Terminal: cci org browser packaging

Resources