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
shakila Gshakila G 

problem with the onclick javascript for this button or link was encountered unexpected token else?

When am trying to execute this javascript button  am getting an error - A problem with the on click javascript for this button or link was encountered unexpected token else

Please let me know, where am doing wrong?


{!REQUIRESCRIPT('/soap/ajax/29.0/connection.js')} 
{!REQUIRESCRIPT('/soap/ajax/29.0/apex.js')} 

IF( NOT( ISPICKVAL(Opportunity.Project_Type__c, 'Under Warranty') )) 

window.parent.location.href ="/0Q0/e?retURL=%2F{!Opportunity.Id}&oppid={!Opportunity.Id}&00N90000002yzdo=<Auto fill by rule>&Name=<auto fill by Rule>&save_new_url=/a06/e?" 

else 

alert(' Sorry for the inconvenience. For Under Warranty service you can't Create a Quote'); 
}
Best Answer chosen by shakila G
Manj_SFDCManj_SFDC
Hello Shakila,
you are missing a semi colon in the if block 

it should be 
window.parent.location.href ="/0Q0/e?retURL=%2F{!Opportunity.Id}&oppid={!Opportunity.Id}&00N90000002yzdo=<Auto fill by rule>&Name=<auto fill by Rule>&save_new_url=/a06/e?" ;

please mark this as solved if this helps you !