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
TrudgeTrudge 

OnClick JavaScript button that's worked fine for 16 months now has "Invalid or unexpected token" error.

Is something out of date with my code?  This button has has perfectly fine since July 2017 and now suddenly my users are getting the "Invalid or unexpected token" error. 

Any help would be greatly appreciated!! 
{!REQUIRESCRIPT("/soap/ajax/32.0/connection.js")} 

if("{!NPAR__c.Status__c}"=="45-Approved for Sample Requests"){ 

var Fields = "&RecordType=012C0000000GT5L"; 

Fields += "&accid={! NPAR__c.AccountId__c }"; 

Fields += "&CF00N1A000006aAj3_lkid={!NPAR__c.Id}"; 

Fields += "&CF00N1A000006aAj3={!NPAR__c.Name}"; 

Fields += "&00NC0000005JZJ5={!NPAR__c.Market_Segment__c}"; 

Fields += "&CurrencyIsoCode=USD - U.S. Dollar"; 

Fields += "&opp11=Ideation/Sample"; 

Fields += "&00N1A000006Ys6M=Recognizing the need for a purchase"; 

Fields += "&opp5=Existing Customer"; 

Fields += "&opp3={!NPAR__c.Account__c} - {!NPAR__c.NPAR_Chemical_Name__c} - <add application here>"; 

Fields += "&ent=Opportunity"; 

var URL = "/006/e?retURL=%2F{!NPAR__c.Id}" + Fields 

parent.frames.location.replace(URL); 

} 

else{ 
alert("Status needs to be '45-Approved for Sample Requests' to create an Opportunity"); 
}

 
Best Answer chosen by Trudge
TrudgeTrudge
I resolved the issue.  The user had entered a carriage return in a field that was passed to the Opportunity.

All Answers

Dushyant SonwarDushyant Sonwar
Hi Trudge,

Try checking the fields that are they having the permission.
and 

try removing the extra spaces from the fields such as below:
Fields += "&accid={! NPAR__c.AccountId__c }";

to
Fields += "&accid={!NPAR__c.AccountId__c}";

Hope this helps.
TrudgeTrudge
I resolved the issue.  The user had entered a carriage return in a field that was passed to the Opportunity.
This was selected as the best answer