Creating an Unlocked Package

Updated 6 months ago by Copado Solutions

Creating an Unlocked Artifact

  1. Open the Artifacts tab and click on New to create a new Artifact record.
  2. Select Package Artifact as Record Type.
  3. Fill in the required fields.
    1. Package type: In this case, Unlocked must be selected.
    2. Artifact Name: No white spaces are allowed for the name.
    3. Source Org Credential: The org credential from where the metadata of the artifact is going to be retrieved.
    4. Artifact Repository: This is the repository where the artifact will be stored.
      1. Artifacts can be saved in a single repository or independently in different repositories.
      2. The metadata of each artifact is saved in a folder labeled with the artifact name.
    5. Target Dev Hub Org: Copado's org credential for the Dev Hub which will be used to create and store the package and its versions.
    6. Source Api Version: The API version the source of your package is compatible with. This field is important if you are using a metadata type that has changed in a recent Salesforce release.
  4. Other relevant fields in a package Artifact record.
    1. Package Id: Related package identifier. Being used as a package Id for package version creation and also used in the sfdx-project.json file as a package alias.
    2. Description: Large description of the package.
    3. Package Namespace: Not required for unlocked packages.
    4. No Namespace: Enables the package creation with no namespace; available only for unlocked packages.
    5. Sfdc Login Url: The login URL that the force:auth commands use. If not specified, the default is Override the default value if you want users to authorize to a specific Salesforce instance.
  5. Click on Save.

Loading Metadata into an Unlocked Artifact

Once you have created an unlocked Artifact record, you can start loading metadata

  1. From the unlocked Artifact record, click on Manage Metadata.
  2. You will see a metadata grid with the metadata from the selected org credential.
  3. Select the metadata you want to include in your package. For example, we can create a Service package that will contain classes, objects, fields, custom labels and so forth, related to Cases.
    1. If you are part of the Metadata Dependency API's pilot program, you can automatically define related metadata by using the Find Dependencies button. See the Metadata Dependencies (Salesforce Beta) article to know more.
  4. Once you have selected all the necessary components, click on Save. Copado will create a new folder in the master branch of the selected Git repository and will commit the selected metadata from the source org credential.
  5. Click on the Back button to return to the unlocked Artifact record.

Generate a Project Definition File

A Salesforce DX Project Configuration file contains all the information needed in order to create an unlocked package.

  1. From the unlocked Artifact record, click on GenerateProject Definition File. You will then see a page with a small summary of the file.

For additional information on how to create a beta version of your unlocked package and promote it to Release, please refer to the article Versioning an Unlocked Package.

How did we do?