So, that's the question, can I make depending on an external managed package (i.e. an app from the app exchange) my second generation package?
1 Answer
Yes, you can. First, see Which Package Dependencies Work with Second-Generation Managed Packages?. The only real limitation here is that a 1GP cannot depend on a 2GP. Dependencies on Unlocked Packages are only "not recommended."
To actually know how do so, read Create Dependencies Between Second-Generation Managed Packages. In summary, you just use the package and version number, like this:
"dependencies": [
{
"package": "[email protected]"
}
]
-
Thank you, but I have another question related. In "OtherOrgPackage" what is supposed I have to write? The namespace of the other package? Commented Dec 4, 2023 at 7:59
-
@FranMejias Namespaces for 2GP are not unique. If you use an alias in
sfdx-project.json
, it's the alias for the package version. You can also use the0Ho
package ID with a version number ([email protected]
), or the04t
version ID (04t0000000ABcDE
). You can find these ID values fromsf package list
if the package is installed in an org.– sfdcfox ♦Commented Dec 4, 2023 at 12:29