Packages

Updated 3 days ago by Copado Solutions

Overview

A package is a logical set of metadata that represents a subset of an org.

With packages you can move to a modular approach for Salesforce development process since packages can be tested independently of other components in your org, and you should be able to release them independently as well. 

The metadata components within a package can only live in one package at a time. The source for your packages is stored in your package repository. Copado takes care of the handling process for you. 

You can define two types of packages:

  1. Git packages:
    1. Version Control Package.
  2. Salesforce packages:
    1. Unlocked packages.
    2. First-generation packages (managed and unmanaged packages).
    3. Second-generation packages (managed packages).

How to Create a Git Package

Once you have completed all the DX requirements, follow these steps to create a Git package:

  1. Create an empty Git repository in your Git server and initialize it.
    Use the same name for the Git repository both in your server and in the Package record.
  2. Create a Git Repository record in Copado with connection details to the previously created repository.
  3. Open the Packages tab, click on New to create a Package record.
    1. Select the Git Package record type. 
    2. Select the org credential for the environment that holds the metadata. 
    3. Select the repository created for the package.
    4. Save.
  4. Click on Manage Metadata.
    1. From the metadata grid, select the metadata to include in the package.
    2. Click on Save
If you are working with tags in Copado releases, your packages will be tagged accordingly.  

How to Create a Salesforce Package

Once you have completed all DX requirements, follow these steps to create a Salesforce package:

  1. Open the Packages tab and click on New to create a package record:
    1. Select the Salesforce Package record type:
      Please note that you will need to assign the Package Artifact layout to the Salesforce Package record type for your user if you haven't done it yet.
    2. Select a package type, Unlocked, Second-Generation Package or First-Generation Package.
    3. Select the org credential for the environment that holds the metadata that will be added to the package. 
    4. Select a target dev hub org, which is the org credential of the dev hub that will be used to create and store the package.
    5. Save.
  2. Click on Manage Package Content.
    1. From the grid, select the Unmanaged Package to use for the package.
      1. If the package is new, click on Refresh List of Packages.
    2. Click on Save
If the package has a key, add it to the Package Key field.

Working with Packages

Once you have created a package, you can create a scratch org and load the metadata, making it ready for use as part of your user stories.

If a new component is created in the scratch org, and you try to commit it from a user story, Copado will prompt you to select the package where this new component should exist.

If you want to apply tags to your packages, you need to add a release to your user stories, and the release must include a version.

When the user story is promoted and then deployed, new elements are pushed to the package repository tagged with the same version as the Release record. If there is no version, the push will be done without a tag. The metadata selection will be included in the Package record and a related Package Version record will be created.



How did we do?