-
“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
This Week’s Top Stories: Salesforce Updates Sales Cloud Features
Salesforce has recently announced a slew of new Sales Cloud features that aim to simplify administrative tasks for sales reps. According to a Salesforce report,…
Salesforce Lightning Web Components Developer Guide Chapter 2: Markup Basics
Here is the second article in our series, where we delve into the LWC basics. In the previous article, we discussed the basic principles and…
Difference Between Palace on Wheels & Maharajas Express Train
When it comes to luxury train travel in India, two names stand out: Palace on Wheels and Maharajas Express. Both offer an opulent experience, but they differ in several aspects, including…