function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
jaybeejaybee 

namespace being stripped out

I have a custom button with javascript -  when i use namespace prefix to refer to a custom setting - it gets stripped out when i look at it again in eclipe

e.g.   in javascript body - {!$Setup.xxx__LL_Config__c.xxx__ServerUrl__c} get reset to {!$Setup.LL_Config__c.ServerUrl__c}.  But when i go to salesforce site and look at the custom button - i see the namespace still there.   Also when i package up the app and then install it in another org, and look at the custom button - i see the namespace stripped out - just like i see it in my eclipse.    BTW my eclipse project is based on the package.

 



sfdcfoxsfdcfox

You answered your own question. A managed package ignores the namespace you are in, thus your code will not reflect that namespace in Eclipse. If you were developing in a non-managed app or in code that references a different namespace, it would appear. This transition haapens automatically; it is not possible to deploy code for a namespace in a different namespace, so it is never ambigious.

 

Example:

 

Let us say you have orgs A, B, and C. A is a developer edition with the namespace A. B is also a developer edition, with namespace B. Finally, C is just a normal Enterprise Edition account.

 

A button created in org A has the A namespace. Once uploaded to the AppExchange, you can install it in org B.

 

Now, if you write code in org B, you can reference the button from org A using the A namespace (A__), while org B would not need a prefix for a new button.

 

Now, if the packages A and B are installed into org C, you would see A__ and B__ prefixes, since C does not have its own namespace.

 

You can't "install" managed code using the metadata API, so there's never a scenario where you would need the prefix in the code when working on a managed package; you would instead need to upload the package and install it using the appropriate install link.

jaybeejaybee

i am having a problem based on this namespace prefix being stripped out.

like i said - i have a opportuntity and event custom buttons and in the button i use {!$Setup.LL_Config__c.ServerUrl__c}  - this works ok in the developement envir.  But when i package up a beta and have another org (B) install the package - the $Setup does not get any value.  I look at the custom buttons and no prefix exists.   So in org B , I edit the custom buttons (make no changes) and save it.  All of a sudden the namespace prefix appears and the $Setup does get the expected value and the app works.  What is going on?  BTW org B is also a developer edition.

Also i install the package in org B using the URL created when the package was uploaded.  I did not put the beta into the app exchange.

This is not consistent - some objects and components have the prefix and some do not.