-
“Unexpected token ‘{ “ error on creating a Javascript button on Opportunity
I want to create a JS button on the Opportunity to replace the current ‘edit’ button. The button would check if some of the feilds have a value, and if so direct the user to a visualforce page, and if not then direct them to the normal edit behaviour.
After saving the button, I get a dialog error “unexpected token '{'”. What am i missing? The code i am using is -IF('{!Account.Type}' == "New") && '{!Opportunity.Ad__c}' == null{
window.parent.location.href = "/apex/OpportunityEditOverride?id="+'{!Opportunity.Id}';
}
else{
window.parent.location.href = "/"+'{!Opportunity.Id}'+"/e?retURL=%2F"+'{!Opportunity.Id}';
}
Log In to reply.
Popular Salesforce Blogs
Save The Date: Salesforce Spring '22 Release Dates Are Here
Attention please: The most eagerly anticipated release updates have arrived. The sandbox preview window for Spring '22 is approaching quickly; plan early so you know…
Drive Omnichannel Customer Experiences with Salesforce Interaction Studio
Discover how leading brands leverage the power of Marketing Cloud Interaction Studio to drive real-time customer experiences — fostering valuable brand engagement at the right…
Triggers in Salesforce - The Complete Guide
Triggers in Salesforce A trigger is an Apex content that executes previously or after information control language (DML) occasions happen. Pinnacle triggers empower you to…