You need to sign in to do that
Don't have an account?
Kim Adil
Remove absolute URL and replace with relative URL in Javascript button
I have a button that route users to seperate URL links based on a checkbox selection. I would like to remove the hard coded URL and use relative instead. Thanks
{!REQUIRESCRIPT("/soap/ajax/25.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/25.0/apex.js")} if ({!CustomObject__c.checkbox__c}== false) { var URL1 = "https://c.cs11.visual.force.com/apex/ObjectCustom?id=" + '{!CustomObject_A__c.Id}'; window.open(URL1); } else { var URL2 = "https://c.cs11.visual.force.com/apex/ObjectCustom?id=" + '{!CustomObject_B__c.Id}'; window.open(URL2); }
It's not required to enter completed URL in the javascript button code, just add the from /apex/visual force page name. Try with the below to work dynamically in different environments