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
MaverickDevMaverickDev 

issue of calling custom setting value in custom JavaScript button - Very Urgent!!

Hi Guys,

 

I'm really stucked at my final stage of coding. I've created a custom button in lead section and i'm calling custom setting url in javascript code.

It works very well in my developer organization but it fails when I installs this in other developer organization.

Here is the code for your reference;

 

{!REQUIRESCRIPT("/soap/ajax/26.0/connection.js")}

var uname = encodeURI('{!$Setup.UserDetails__c.UName__c}'); 
var ukey= encodeURI('{!$Setup.UserDetails__c.Sha1Key__c}'); 

try{
var rurl= escape('/handleapprequest?email={!Lead.Email}&fname={!Lead.FirstName}&lastname={!Lead.LastName}&company={!Lead.Company}');

window.open('{!$Setup.UserDetails__c.Url__c}login/' + uname + '/'+ ukey +'?returnurl='+rurl, 'Send Email', 'height=600,location=no,resizable=yes,toolbar=no,status=no,menubar=no,scrollbars=1', 1)

}catch(err)
{alert(err);}

 When I install my package to different developer organization, the button which executes onClick javascript, thows an exception 'A problem with the OnClick JavaScript for this button or link was encountered: Field Setup.UserDetails__c.UName__c does not exists check spelling'

Please, let me know what is going wrong here? I've already created Beta package and I can not change or remove code from my developer org. 

Thanks a lot.

sivaextsivaext

Hi

 

1. are you added custom settings i.e objects and fields

2. try in this way

 

   var uname ="{!$Setup.UserDetails__c.Uname__c}";