Creating an Unlocked Package
Creating an Unlocked Package
- Open the Packages tab and click on New to create a new Package record:
- Select Salesforce Package as record type.
- Fill in the required fields:
- Package Name: Give your package a name. Please note that blank spaces are not allowed.
- Package type: Select Unlocked.
- Source Org Credential: The org credential from where the metadata of the package is going to be retrieved.
- Package Repository: This is the repository where the package will be stored.
- Packages can be saved in a single repository or independently in different repositories.
- The metadata of each package is saved in a folder labeled with the name of the package.
- Target Dev Hub Org: The org credential of the dev hub org which will be used to create and store the package and its versions.
- 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.
- Other relevant fields in the Salesforce Package record:
- Package Id: Related package identifier. It is used as a package Id for package version creation and also used in the sfdx-project.json file as a package alias.
- Description: Add a description for the package.
- Package Namespace: This field is not required for unlocked packages.
- No Namespace: Enables the creation of a package with no namespace and is available only for unlocked packages.
- Sfdc Login Url: The login URL that the force:auth commands use. If this is not specified, the default will be login.salesforce.com. Override the default value if you want users to authorize to a specific Salesforce instance.
- Click on Save.
Loading Metadata into an Unlocked Package
Once you have created the unlocked package, you can start loading metadata:
- From the Package record, click on Manage Metadata:
- You will see a metadata grid with the metadata from the selected org credential:
- Select the metadata you want to include in your package. For example, you can create a Service package which classes, objects, fields, custom labels and so forth, related to cases.
- 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.
- Click on the Back button to return to the record page.
Generate a Project Definition File
A Salesforce DX Project Configuration file contains all the information needed in order to create an unlocked package.
- From the Package 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.