In the "Unlocked Packages for Customers"-Trail below "Simple Packaging Use Cases" it is recommended to create two completely new projects for the two different internal business applications (the examples are the finance group having an app for employees to submit expense (Project A) and the HR team having an app where employees refer potential hires (Project B)).

Shall two different namespaces be used for those two projects?

From my point of view it has to be done.
Reason: In both projects I have a class called TestDataFactory. When trying to install unlocked packages created based on these two projects, it would result in an error (since the unlocked Package X from Project A has already the component ApexClass:TestDataFactory and unlocked Package Y from Project B would also try to install an ApexClass with the same name).

Is that correct or am I missing something/having a wrong approach?

Thank you very much


Yes, that's the purpose of namespaces, to allow different unlocked packages to exist in the same org, even if they share components with the same name. Aside from trying to coordinate with other projects to make sure there's no name conflicts, this feature is the easiest way to handle the situation, since it automatically prevents conflicts that would otherwise occur.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.