-
“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 the Cost of Salesforce CRM Consulting in India?
Salesforce is one of the most widely used CRM platforms in the world. Small and large businesses use it as it offers various modules, including…
5 Things To Consider When Switching From Salesforce Classic To Lightning
Are you still, using Salesforce Classic? If yes, don't hold your breath for anything "new and exciting" to arrive anytime soon. The best method to…
Reinforcing Fintech Companies, Salesforce Extends Einstein Analytics For Financial Services Cloud!
There has been a rapid change in the banking and wealth management industry, lately. Several modern fintech competitors have stepped in to simplify the ways…