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
SFDC coderSFDC coder 

Unexpected identifier javascript error

hi All,

i am facing some weird error with javascript custom button.I have javascript custom button that works for some record whereas for some it gives an error as "Unexpected identifier". However when i try to investigate this further, i see some issue with this particular statement highlighted below:-

if({!Account.Order_Block__c}==true || {!Account.Order_Block_on_sales_area__c}==true)
{
var x=confirm("{!Order__c.Business_Partner__c}"+' Business Partner is blocked for Order entry. Are you sure you want to continue?'); 
}

when the above statement doesnt work for some records, i have to modify it as under
var x=confirm('{!Order__c.Business_Partner__c} Business Partner is blocked for Order entry. Are you sure you want to continue?'); 
It seems to be a very lame solution to every now and then change the code with the previous version .Is there a permanent solution for this one?

Any help is appreciated
Mudasir WaniMudasir Wani
Hello,

I can see only one difference that is double quotes.

Try this 
var x=confirm('{!Order__c.Business_Partner__c}'+' Business Partner is blocked for Order entry. Are you sure you want to continue?');


Please mark this as solution if this solves your problem, So that if anyone has this issue this can help.