You need to sign in to do that
Don't have an account?
Michele Toscano
Javascript custom button: getting unexpected token { error
My sytax is not getting an error when I check it via my javascript button - however, when I click the button which executes it - it throws an unexpected token { error. What am I doing wrong?
//Subregion consideration
If ({!ISPICKVAL(Account.Sub_Region__c, 'NA')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'SA')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'EU')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'ME')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'CN')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'AS')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'AN')
}) {
//there is a bunch more code here.......if......blah blah
//Subregion consideration
} else
alert('A valid subregion is required for customer conversion.');
//Subregion consideration
If ({!ISPICKVAL(Account.Sub_Region__c, 'NA')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'SA')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'EU')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'ME')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'CN')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'AS')
} ||(!ISPICKVAL(Account.Sub_Region__c, 'AN')
}) {
//there is a bunch more code here.......if......blah blah
//Subregion consideration
} else
alert('A valid subregion is required for customer conversion.');
== 'AN')
}){I don't have your complete source code.
https://success.salesforce.com/answers?id=90630000000D8sJAAS
If(ISPICKVAL(record.Resolution_Code__c,"Referred to Vendor")
becomes
if("{!Case.Resolution_Code__c}" == "Referred to Vendor")
Simple or double quotes work in javascript.
If ( "{! Account.Sub_Region__c}" == "NA" ) // with double quotes
I found this direct conversion very often for picklists (with or without quotes). It seems that double quotes is the better choice here.