If we have a lightning component, which is a part of managed package, is possible somehow purely from js code to figure out current namespace, i.e. without sending additional request to the server? I know how to do this in apex, but now I'm interested in js solution.

Thanks in advance


I thought this would not work but it seems to in one of my development org with the component bundle version set to 40.0 (so locker should be enabled)


Which outputs the namespace for the component. No idea if it will continue to work or is scheduled to be removed so use at your own risk

This does throw an error

  • for me this works perfectly! – Uwe Heim Apr 26 '19 at 17:14

How about this


If no namespace it will return "c".

  • This is working fine with Spring 20! – Michael Sobczak Mar 25 '20 at 16:31

I am afraid that this is not possible since it has been possible to query the namespace of the organisation only after the Spring'16 release. There are no global value providers for this in lightning.

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.