Package Dependencies Overview
The package dependencies feature allows you to make Salesforce packages dependent on each other. You can now develop and maintain a set of interdependent packages with the flexibility to promote them separately in a modular way.
Creating a Package Dependency
In order to create a package dependency in Copado, follow the steps below:
- Navigate to the Package Dependencies related list in the unlocked package or 2GP Package record.
- Click on New.
- Fill in the relevant fields in the Package Dependency record:
- Dependent Package: Designates the package record which cannot be installed or managed without the depending one.
- Depending Package: The depending Salesforce package which contains required dependencies for the metadata of the dependent package.
- Depending Package Version: The minimum or exact version of the depending package. This particular version will be used during version creation and installation operations.
- Depends on the latest version: If checked, the latest version of the depending package will be used when creating a new version and for installation operations.
- Once a dependency record is created, you will need to generate a new version of the package so that the new version is aware that it has a dependency. To generate a new version, click on Generate New Version in the unlocked package or 2GP Package record.
Package dependencies can be seen at the moment of loading metadata into a scratch org.
- In the first step in the Scratch Org Wizard, from the metadata sources available, select Unlocked Packages or Second-Generation Packages.
- In the next screen, enter the Sfdx Project details.
- Select a package and a version and click on Add to Selection.
- If the selected package has any packages dependent on it, they will be selected automatically. You can scroll down to the Selected Packages section where all the packages selected will be listed.
- Firstly, you will see the package you have selected. The Included by column value will be User Selected.
- Secondly, you will see all the dependent packages. The Included by column value will be the name of the main package.