-
“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
What’s New in Salesforce Health Cloud Features? – Summer ’19
Salesforce Health Cloud Features – Salesforce releases more than 150 features three times a year during its seasonal releases – Spring, Summer, and Winter. Each…
Salesforce for Energy and Utility Sector for Adapting to New Customer Expectations
Energy and utility companies are known to have contingency plans to remain stable in any uncertain situation. And that’s where digitization has helped such companies…
Order of Execution in Salesforce
Order of execution in salesforce is like an ABC in Salesforce World, make sure you should understand:- System Validation rule(required field, field format). Before Trigger…