-
“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
Data Quality Analysis Dashboard App in Salesforce
As you all know about the importance of Data Integration in Salesforce, we should understand that before Data integration, Data Quality analysis and management are…
What are Salesforce Flows? | The Ultimate Guide
Salesforce Flows is a powerful tool that allows users to automate business processes and simplify tasks within the Salesforce platform. Flows are a visual, declarative…
URL Hacking in Salesforce - Episode 3
HEY!!! Welcome back, previously in URL Hacking Episode 2, we see how to make possible and working of the pre-populated field values via a custom…