-
“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
How do I Choose a Salesforce Implementation Partner?
Hey there! If you’re reading this, chances are you’re looking to take your business to the next level with Salesforce. That’s a fantastic move! Salesforce…
What is Salesforce? Learn About Salesforce Products Here
Routine Automation collected all you need to know and combined it into an introduction to Salesforce. What does Salesforce do exactly? How to use Salesforce? In…
How to Design Salesforce Approval Processes for Complex Business Workflows
Growing businesses often require several levels of review before approving discounts, contracts, expenses, purchases, and customer requests. Manual approvals can create delays, inconsistent decisions, and…