-
“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
Why Salesforce Nonprofit Partners Are Essential for Your Organization’s Success
Salesforce offers a wide range of tools for sales, marketing, customer service, and analytics in one integrated system. Nonprofits use this powerful and customizable platform…
Learn Salesforce Einstein – Chapter 9 (Testing – Test the Einstein Model)
On this page, you can test your model. Copy model ID from your model and paste it in Model ID on this page. Your model…
What are Apex Triggers? | All You Need to Know
Before reading this blog, you must have basic knowledge of Apex Language and SOQL. Apex triggers can invoke apex code and enable you to perform…