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

How to use custom setting values in Java Script

I need to refer a custom settting field in the Javascript button.

How do we refer custo setting values in Java script button code

There is a Salesforce article for exactly this requirement.

Satish Kumar
Please mark my answer as a solution if it was helpful so it is available to others as a proper solution.
If you felt I went above and beyond, please give me Kudos by clicking on the star icon.
@Satish, the link above leads to a blank screen.
Hello Ryan, try below
var url = "{!$Setup.CustomSettingName__c.CustomFieldName__c}";
@john4sfdc This is clearly outside my skills. I am not really sure where I would put that in the Java Script:

var metadata = sforce.connection.describeSObject('OpportunityLineItem'); 
var dontdo = ['TotalPrice']; //Add fields to blank here. Total price or Unit price is needed at minimum 
var fields = []; 
for (var i = 0; i < metadata.fields.length; i++) { 
if (metadata.fields[i].createable == "true" && dontdo.indexOf(metadata.fields[i].name) == -1){ 

fieldlist = fields.join([separator = ',']) 
var cloner = sforce.connection.query("SELECT " + fieldlist + " from OpportunityLineItem where id ='{!OpportunityLineItem.Id}' limit 1"); 

records = cloner.getArray("records"); 

delete records[0].Id; 
//records[0].Product_Stage__c = 'Closed Won'; // Manually override any fields down here 

result = sforce.connection.create(records); 
var editparams = ''; 
//var editparams = "&00N34000004DVHD=Closed%20Won&00X64000002DBDS=&00N24000006XBDp=&ServiceDate=&VT00S53000003CFSA=&DW00D52000002FXGs="; // Any url hacking style parameters you want added to the edit window when we open the cloned object. Can be used to blank a field that was required forcing the agent to override the default. 
window.location = '/' + result[0]['id'] + "/e?&retURL=" + result[0]['id'] + editparams;