-
“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
Different Types of Object Relationships in Salesforce
In Salesforce, we can associate one object with another object. We can create the relationship by creating a custom relationship field of an object. By…
How to Set Up Multi-Factor Authentication in Salesforce
The original article was published on the Advanced Communities blog. Protecting sensitive data is critical. As cyber threats continue to rise, securing your Salesforce environment…
Salesforce Consulting Services: How to Make Good Sales with Salesforce Sales Cloud?
For a salesperson, the best way to showcase their presence is to stay close to their clients. However, the arrival of the COVID-19 pandemic has…