+ Start a Discussion
Matt Scholl 10Matt Scholl 10 

Custom javascript button no longer working - now getting missing ;

I have a custom javascript button that was working last week. Now it is not. Now I get a "missing ; before statement" error when the button is clicked. The code still passes the syntax check. Did something change with Winter 16 that broke the javascript?
I have tried adding a ; after the REQUIRESCRIPT line, but get the same result.​

User-added image

{!REQUIRESCRIPT("/soap/ajax/27.0/connection.js")}
if ('{!Opportunity.Agreements_Created__c}' == 0){
var r = confirm('Are you sure you want to request a contract?\n\nOnce a request is saved, a contract request will be submitted.');
if (r == true){
var URL = '/a2J/e?00N32000002Yv0Z={!Opportunity.Account} - Contract Request&CF00N32000002Yv0Y={!Opportunity.Account}&CF00N32000002Yv0Y_lkid={!Opportunity.AccountId}&CF00N32000002Yv0b={!Opportunity.Name}&CF00N32000002Yv0b_lkid={!Opportunity.Id}&retURL=%2F{!Opportunity.Id}';
window.location.href = URL;
}
else{
setTimeout(function(){alert('Request cancelled.'); },1001);
}}
else{
setTimeout(function(){alert('A contract already exists for this Opportunity.'); },1001);
}