0

In our managed package we have 'XYZ' namespace in most of our product sourcecode.

When we try to get this to DX, as per their guide here we must create an unmanaged package.

Salesforce doesn't allow creating an unmanaged package with sourcecode which has references to a namespace and throws below Error.

Unmanaged packages cannot explicitly reference this organization's namespace.

I think this is fair because we cannot ship an unmanaged package with a namespace.

But we noticed custom objects can be packaged as unmanaged with namespace, and even after we moved to DX, they still shows up in DX orgs with namespace.

Is there a way that we can transport our sourcecode with managed package references to DX? Appreciate any help, Thanks.

2

Yes you can easily move the package org code into DX. The first step you need to do is Add the namespace in your project-Scratch-def file.

{
    "orgName": "Dev Demo",
    "edition": "Developer",
    "namespace": "SFDevDemo",
    "orgPreferences" : {
        "enabled": ["S1DesktopEnabled"]
    }
}

Then you will not face any namespace related error. Using SFDx you can fetch the Metadata in your local system and then convert that into SFDX format. Once the code is in SFDX format you can easily push that into new scratch org and can continue your development.

Deploy the Package Code using SFDX

|improve this answer|||||
  • Thanks @Tushar Sharma, Is there a way that we can move the package source from DE to DX without doing any code changes please? because the issue seems to be Salesforce doesn't allow creating an unmanaged package from a source where fields, classnames, objects, etc. referred with namespace. – Pasan Eeriyagama Jun 3 '18 at 23:17
  • @PasanEeriyagama After adding namespace most of the code can be transfer without any changes. But there are some limitations in DX in that case you might need to change it – Tushar Sharma Jun 4 '18 at 2:06
  • 1
    Thanks, I think I got it now, regardless unmanaged or managed we can simply retrieve the source+meta from any package after we link through devhub. – Pasan Eeriyagama Jun 4 '18 at 3:32
  • @PasanEeriyagama yes you are correct here. – Tushar Sharma Jun 4 '18 at 4:38

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.