-
“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 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…
A Nonprofit's Success with Salesforce
Case Study: Nonprofit Organization Leverages Salesforce for Growth Organization: The Community Foundation Challenge: The Community Foundation struggled to manage donor relationships, track donations effectively, and…
Salesforce Summer '23 Release Highlights
Salesforce is heating up with new features in the Summer '23 update! Sit back and enjoy the sunshine and the bright innovations that will increase…