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

custom setting values from Opportunity Custom Button or Link

I have a Opportunity Custom Button or Link definition and trying to get a custom setting value.


the custom button has these values :::


Namespace PrefixxxxDisplay TypeDetail Page Button
BehaviorExecute JavaScript  
OnClick JavaScript
startMeeting("{!Opportunity.Id}", "{!Opportunity.Name} {!$Label.xxx__ll_meeting}", "{!$User.Id}", "{!$User.FirstName} {!$User.LastName}", "{!$Setup.xxx__LL_Config__c.xxx__ServerUrl__c}");


{!$Setup.xxx__LL_Config__c.xxx__ServerUrl__c}  in my developer environment - this seems to work ok but when i package it up and install in another org the value is empty string.    Wondering what could be the problem.   I looked for $Setup  but i could not find any doc on this.



{!$Setup.xxx__LL_Config__c.xxx__ServerUrl__c}  is on a normal visualforce page and it seems to get the value correctly.  I guess when the opportunity object gets displayed with the custom button - {!$Setup.xxx__LL_Config__c.xxx__ServerUrl__c}  does not work.



It seemds when you installed the managed package in poduction org,  you did not provide the values for custom setting field values in installed package org. When one installs a managed package in an org, custom setting object and fields which are included in the managed package comes in the org where the package is installed but values of these components like "Custom Settings" do not come with package. Its a part of speed up , one has to provide required values in these custom setting object which you have come to the org as part of the installed package.


Did this answer your question? If not, let me know what didn't work, or if so, please mark it solved. 


the custom setting do have value - and getting the value form a visualforce page using - $   works ok -  it's only when $ is being invoked from a custom button do i get no value or msg  A problem with the OnClick JavaScript for this button or link was encountered: You referenced an unsupported field type called "Lookup" using the following field: ServerUrl__c


so basically - seems that $Setup works when in a visualforce page but not when it is an event or opportunity custom button.  and of couse on the developer login both work ok.


so new info - so in the custom button objects - in the javascript section i have something like this (see first my first post)

startMeeting("{!Opportunity.Id}", "{!Opportunity.Name} {!$Label.xxx__ll_meeting}", "{!$User.Id}", "{!$User.FirstName} {!$User.LastName}", "{!$Setup.LL_Config__c.ServerUrl__c}");


I initially suspected that having no namespace prefix was the source of my problems.  So i want to change {!$Setup.LL_Config__c.ServerUrl__c};  to {!$Setup.xxx__LL_Config__c.xxx__ServerUrl__c};   where xxx__ is the namespace prefix.


I made the changes from the salesforce IDE and save it but prefix gets stripped out.   I made the changes from the salesforce web page and refresh the IDE and it gets stripped out again.  When i look at it from web page i see the prefix but not from the IDE.  Other changes i make to the file i can see in the IDE.  BTW - the project on the IDE is based on the package.  When i upload and create the package - and install  it on another org - i get the errors i mentioned earlier.  I also look at the the custom buttons and see no prefix.   So i looked at the custom button from the org that installed the app package and did not see namespace prefix - i decided to try to edit it - i was not allowed to edit the javascript section but when i saved the custom button object - all of a sudden the namespace prefix appears and the app works correctly.  What is going on - this is a managed package.

why is the prefix being stripped away and why is it reappearing when i edit it from the org that installed the package.