Create Org-Dependent Unlocked Packages

Org-dependent unlocked packages are a variation of unlocked packages that allow you to create packages that depend on unpackaged metadata in the org where you plan to install the package (installation org).

To create packages:Create and Update Second-Generation Packages

Untangling your production org metadata can be a daunting project. But now you have a solution that enables you to package metadata without completely accounting for all metadata dependencies: org-dependent unlocked packages. When you use org-dependent unlocked packages, metadata validation occurs during package installation, instead of during package version creation.

Longstanding and large production orgs often accumulate large amounts of metadata that are difficult to modularize when adopting a package-based Application Lifecycle Management (ALM) approach. Instead, you can package metadata that depends on unpackaged metadata in the installation org.

Org-dependent unlocked packages are a variation of unlocked packages, and not a separate package type. They follow the same package development steps, and use the same supported metadata types as unlocked packages.

Note

To create an org-dependent unlocked package, specify the orgdependent CLI parameter on the sf package create CLI command.

1sf package create -t Unlocked -r force-app -n MyPackage --org-dependent
ScenarioUnlocked PackagesOrg Dependent Unlocked Packages
Build once, install anywhereYesNo. These packages are designed for specific production and sandbox orgs. You can install them only in orgs that contain the metadata that the package depends on.
Dependency validationOccurs during package version creationOccurs during package installation
Can depend on other packagesYesNo
Requires dependencies to be resolved to create the packageYesNo
Supported metadata typesSee the unlocked packaging channel of the Metadata Coverage Report.See the unlocked packaging channel of the Metadata Coverage Report.
Recommended development and testing environmentUse scratch orgs to develop and test your unlocked packages.Use a sandbox that contains the dependent metadataConsider enabling Source Tracking in Sandboxes to develop your org-dependent unlocked package. Then, test the package in a sandbox org before installing it in your production org.
Code coverage requirementBefore you can promote and release an unlocked package, the Apex code must meet a minimum 75% code coverage requirement.We don’t calculate code coverage, but we recommend that you ensure the Apex code in your package is well tested.

To review which of your packages are org-dependent unlocked packages, use sf package list --verbose.