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
DrawloopSupportDrawloopSupport 

Custom Setting Field in Managed Button Removes Namespace from Fields

Let's say we have a button pointing to this URL:

 

 

https://www.sample.com?customSetting={!$Setup.Namespace__Info__c.Namespace__Field__c}&customField={!Namespace__CustObj__c.Namespace__CustField__c}

 

 

where Namespace__Info__c refers to a Custom Setting, Namespace__Field__c is a field on that Custom Setting, Namespace__CustObj__c is a custom object, and Namespace__CustField__c is a field on that custom object. This is all within a managed package.

 

When this button is rolled out in a managed package version, the Namespace__ is removed from all of the fields and this button no longer works in an org with this version installed. If the Custom Setting field is removed, the Namespace__ remains intact for the custom object and field.

 

I think this is a Salesforce bug, but I wanted to bring it up here before opening a ticket to see if anyone has seen or dealt with this issue. Thanks in advance!

dwatsondwatson

I've encountered this bug also.  Protected custom settings have the namespace removed meaning the only place you can use them in a managed package is in Apex code.   I think this is a salesforce bug too.  

 

I'm not sure if you're aware so I'll mention it, your custom setting will work fine in a managed package as long as you change it to Public instead of Protected.

 

 

DrawloopSupportDrawloopSupport

Unfortunately, since I've already packaged it up as a non-beta version, I cannot change the visibility. I suppose I could just create another custom setting, but it seems like this should be something Salesforce should address.

 

Thanks!!

dwatsondwatson

I discovered this bug before Winter '11 and was hoping it would be fixed with Winter '11 but that hasn't happened.  

 

If you want to avoid adding additional stuff to your managed package that should it ever get fixed you won't be able to remove later on you could also just instruct people to create the button themselves after they install the package.  They would just have to copy and paste the button that gets installed with the package and prefix the namespace where appropriate.  

 

What I found particularly annoying about this bug was that the problem isn't that your protected custom setting doesn't work, it works just fine.  It's just that the namespace gets stripped off of anything non-apex that tries to use it.