While developing managed packages with DX I constantly run into the following problem:

  1. My developers use DX scratch orgs and the code uses the namespace we also latter use in the packaging org.
  2. My tester don't want to use scratch orgs for testing, so we deploy our code (by done feature) using metadata convert into a regular developer org (without namespace).
  3. We constantely forget to remove the namespaces from Aura component markup and JS and therefore get "Doesn't work" bug tickets.

Is there a better way to test (always create a Beta package) or is there a safe DX CLI command to remove namespaces?

  • 2
    For point #3, consider pulling the namespace dynamically in Apex so that you never run into hardcoding namespaces. This one liner works for me: public static final String CURRENT_NAMESPACE = MyAuraController.class.getName().split('\\.')[0]; Commented Apr 30, 2019 at 9:33
  • How would that help with namespaces in component markup or JS files. Often records are passed around and field need to be retrieved correctly. I don’t know of any way to do that differently. Commented Apr 30, 2019 at 20:26
  • 1
    I normally wrap sObjects in message classes to avoid just this problem. Commented Apr 30, 2019 at 20:28
  • Question: Why don't the testers want to use SFDX? why is it different for them? Commented Apr 30, 2019 at 20:29
  • 1
    If they know how to goto test.salesforce.com then I fail to see what is different. Give them username and password as it all works the same. Guess I am a bit confused. They do not need to use the cli.
    – Eric
    Commented May 1, 2019 at 6:29

1 Answer 1


There is no magic scripts available to strip of the namespace from the aura components.

I usually instruct developers to not use the namespace in code and work towards making components completely namespace independent .

Even if they have to hard code namespace do not use it everywhere. Just have it in common place where one could change it later easily .

One way to allow testing in sandbox with namepsaced code is to create a BETA package and install or even release a package if uninstalling Everytime is pain and has lot of config (version number will go up but that's fine does not hurt much)

  • Beta packages are a no go because you have to uninstall them. Released packages are not made for unready states. So the only option is to get rid of namespaces in aura cmp and js and I don’t get how you do that’s. Commented Apr 30, 2019 at 20:33
  • 2
    By using wrapper apex class for every sobject and avoiding use of __c variables altogether on markup . Commented Apr 30, 2019 at 20:35
  • 3
    Also what do you mean by release packages are not made for unready states ? Is there a limit on no of versions you can have etc etc ? No right .just keep incremeting by patch no (major.minor.patch) and when ready create a package with major.minor Commented Apr 30, 2019 at 20:36
  • Ok, you are right. But it feels somewhat bad to create a release package just to deploy my implemented story to a tester. But if that is the recommended way I just have to unlearn this. Commented Apr 30, 2019 at 20:44
  • 3
    If it is per story then I think it will be too much to generate a package but if it is for a every two weeks it makes sense to just test the package. I would also push the tester on why he needs something in sandbox to test ? Every release testing or qa with bunch of stories makes sense .I would rather then use sandboxes for my dev ops process and build than fancy scratch orgs in this scenario. Commented Apr 30, 2019 at 20:47

You must log in to answer this question.

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