-
“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
Vital Integrations for Your B2B Customer Portal
When running a B2B customer portal, it’s essential to create the right infrastructure around it to provide your business customers with necessary services such as…
Tips to Choose Reliable Salesforce Consulting Partners in 2019
Salesforce now helps enterprises to streamline various facets of a business ranging from sales to product delivery and customer support. Salesforce is so popular for…
Update Related Record Using Salesforce Flow - A Complete Guide
Introduction Sometimes we have to update related object records. For updating the related object records we can use different methods but for now, we will…