+ Start a Discussion
SFDC2 Admin2 7SFDC2 Admin2 7 

javascript was working yesterday but now is not

Hello everyone,

So I had two buttons that were working fine up until yesterday and now both of them are coming back with the same exact error message. They both do the same thing, allow an attachment to a list of e-mail addresses while date stamping a value. Their last modified date was 5/16/2016 and now they are both not working. Here is my code, I haven't run any updates. I am also willing to change this button as long as the same things can be accomplished.
 
{!REQUIRESCRIPT("/soap/ajax/25.0/connection.js")} 
{!REQUIRESCRIPT("/soap/ajax/25.0/apex.js")} 

location.replace('/email/author/emailauthor.jsp?retURL=/{!Opportunity.Id}&rtype=003&p24={!Opportunity.OwnerEmail}&p4=(___EMAIL ADDRESSES REMOVED PURPOSELY___)&template_id=239291302&p6={!Opportunity.Name}'); 

var oppObj = new sforce.SObject("Opportunity"); 
oppObj.Id = '{!Opportunity.Id}'; 

var build = new Date(); 

var month = build.getMonth(); 

var day = build.getDate(); 

var year = build.getFullYear(); 

var today = new Date(year,month,day); 
try 
{ 
oppObj.CL2_Binder_Date__c = today; 
sforce.connection.update([oppObj]); 
} 
catch(e) 
{ 
console.log(e.message); 
}

 
Azharuddin KhanAzharuddin Khan
May be you try something called as debugging.
 
Edwin VijayEdwin Vijay
What is the error message you get?
SFDC2 Admin2 7SFDC2 Admin2 7
A problem with the OnClick JavaScript for this button or link was encountered:

missing ) after argument list
I figured it out. It wasn't executing any code(so no debug logs, thanks Azharuddin Khan I think I know how to debug) since I'm doing a link replacement. I thought it was because ajax libraries got moved internally on the server, but it was much simpler than that... The opportunity name had an ' in it, so the link replacement code wasn't executing.