3

We've been experimenting with moving some of our code into unlocked packages, however we'd like to understand how to back-out of this if necessary.

As a test, we moved a bunch of "utility" type classes into a separate folder, made a package of this, and deployed it into a sandbox. So far so good.

Uninstalling the package fails for the understandable reason of non-packaged code in the sandbox having a dependency on these util classes.

So next, we move one of the util classes from the package folder back to it's original location, make a new package version, and try to deploy. This fails as it wants to delete the class and cannot, so we install again, picking the option to "deprecate metadata types removed from the package".

This works, and I'm left with the class marked with a red X and a tooltip of "Managed - installed deleted".

Next, I try to deploy that same class from VSCode using the non-package-folder source. This also works, but doesn't change how the class displays in the list, so it seems the class is "attached" to the package forever?

Questions:

  • how can we get Salesforce to "un-link" the class from the pacakge it's no longer part of?
  • documentation suggests that "deprecated" only applies to Managed packages, yet ours isn't - is the documentation correct?

1 Answer 1

2

how can we get Salesforce to "un-link" the class from the pacakge it's no longer part of?

Go to Setup > Installed Packages > Package Name > View Components. You can individually remove elements from the package. Alternatively, remove all the components from the package, upload a new version, then install the new version with the "deprecateOnly" option. The items will appear as "Deprecated", but you can then add them to a new package if you want.

documentation suggests that "deprecated" only applies to Managed packages, yet ours isn't - is the documentation correct?

Deprecated only applies only to Unlocked Packages. Managed Packages always delete components that are removed.

1
  • Thanks- the remove option worked!
    – James
    Commented May 16 at 13:55

You must log in to answer this question.

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