-
“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
All About Salesforce Health Check 101
If you are a Salesforce admin, your major worry must be security. You will be extra cautious as you are handling customer data and yes,…
Comparison Between Salesforce B2B and B2C Commerce Cloud Solutions
The proliferation of the internet and smart devices has forced us to enter the digital-first economy, where online trade has become the lifeline for most…
Salesforce Nonprofit Cloud Spring '24 Highlights
While many of us are still feeling the chill of winter, Salesforce's Spring '24 release is in full bloom! Let's review some of the Nonprofit…