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.

1 Answer 1

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

4
  • 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. Jun 3, 2018 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 Jun 4, 2018 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. Jun 4, 2018 at 3:32
  • @PasanEeriyagama yes you are correct here. Jun 4, 2018 at 4:38

You must log in to answer this question.

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