2

This is a question about orgs containing a namespaced unlocked package that have been in use for some time so there is lots of valuable data.

The goal is to move to a second generation managed package of the same code.

  1. Can the managed package have the same namespace as the unlocked package?
  2. Is there a way to replace the unlocked package with the managed package in orgs that preserves the data created using the unlocked package?

1 Answer 1

2

Just tried moving components from an unlocked package to a managed package using the same namespace. When that managed package is installed, the sort of errors you get are:

Error (1): Encountered errors installing the package! Installation errors: 
1) Cannot add component of type:CustomField named:Fund__c.PortalCustomTab4Name__c subjectId:00N01000005LqrI to another package because it is an installed component., Details: package.xml: Cannot add component of type:CustomField named:Fund__c.PortalCustomTab4Name__c subjectId:00N01000005LqrI to another package because it is an installed component. 

Using the "Remove" button on the "Installed Package Detail" of the unlocked package solves the problem, but in our case we have hundreds of components so doing this manually is not appealing. This may be a viable approach: Remove component from Unlocked Package programmatically but still seeing a lot of errors that require manual intervention. More on that here How to bulk remove components from an unlocked package?.

The pragmatic solution I've gone for is also described in an answer here How to bulk remove components from an unlocked package?.

PS

The Salesforce support response to a case I created asking this was:

We, unfortunately, would like to inform you that this is beyond the scope of support of our developer teams, it was advised that you will need to uninstall the package and recreate it as a managed package.

You must log in to answer this question.

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