0

I have a requirement to split project's code into two parts:

  • Unmanaged part - mostly, it's custom data model. Should be editable in client's org.
  • Managed part - wrapped in 2GP Managed Package. There should be Apex Classes, Aura Components etc. Components should reference data model included in Unmanaged part. It should NOT be editable or even visible in client's org.

I've already split the code in such way, that Unmanaged part does not depend on managed part - it's obvious. But managed part depends on unmanaged part on purpose.

Now, I'm trying to create managed package version of the code, but verification of metadata ends with errors telling, that managed code part Apex does not recognize particular custom objects. I think it's totally justified error, so I added --skipValidation flag thinking, that during installation in org, which already has the unmanaged part, it will resolve the references correctly. I was wrong - installation, also returns errors complaining about using API names not resolving to a valid sobjects.

Is it possible, to meet my requirements? What can I do to create managed package, which refers to custom objects from outside the package?

I read about Org-Dependent Unlocked Packages, but they don't satisfy the requirement, which is hidden code in client's org.

1 Answer 1

2

This is not possible. Unmanaged, First Generation, and Second-Generation Managed Packages must stand alone. Only Unlocked- and Org-Dependent Packages support depending on unmanaged metadata (the former automatically incorporates overlapping unmanaged data into itself, while the latter can specify external dependencies that are unmanaged).

2
  • Thanks for solid response. Anyway, I'm a bit surprised, but not of the answer. Yesterday I was listening Salesforce Developer podcast about a guy who helps people on StackExchange. Today he replies to my question. Nice ;) May 27, 2022 at 15:11
  • They don't actually have to be standalone, but dependencies must be other managed packages, not subscriber metadata.
    – Phil W
    May 27, 2022 at 16:14

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .