Newer Version Available

This content describes an older version of this product. View Latest

Create Org-Dependent Unlocked Packages (Beta)

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).

User Permissions Needed
To create packages: Create and Update Second-Generation Packages

As a beta feature, Org-Dependent Unlocked Packages is a preview and isn’t part of the “Services” under your master subscription agreement with Salesforce. Use this feature at your sole discretion, and make your purchase decisions only on the basis of generally available products and features. Salesforce doesn’t guarantee general availability of this feature within any particular time frame or at all, and we can discontinue it at any time. This feature is for evaluation purposes only, not for production use. It’s offered as is and isn’t supported, and Salesforce has no liability for any harm or damage arising out of or in connection with it. All restrictions, Salesforce reservation of rights, obligations concerning the Services, and terms for related Non-Salesforce Applications and Content apply equally to your use of this feature. You can provide feedback and suggestions for Org-Dependent Unlocked Packages in the Trailblazer Community.

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 package:create CLI command.
1sfdx force:package:create -t Unlocked -r force-app -n MyPackage --orgdependent
Scenario Unlocked Packages Org Dependent Unlocked Packages
Build once, install anywhere Yes No. 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 validation Occurs during package version creation Occurs during package installation
Can depend on other packages Yes No
Requires dependencies to be resolved to create the package Yes No
Supported metadata types See the unlocked packaging channel of the Metadata Coverage Report. See the unlocked packaging channel of the Metadata Coverage Report.
Recommended development and testing environment Use scratch orgs to develop and test your unlocked packages. We recommend using Source Tracking in Sandboxes (Beta) to develop your org-dependent unlocked package. Then, test the package in a sandbox org before installing it in your production org.

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