You need to sign in to do that
Don't have an account?

Java script - Unexpected token ILLegal
Hi,
I created a custom button that should redirect to different apex page based on the record type.
Example: If record type = a then it should redirect to "abc" page otherwise "xyz" page
But when i click on the button i get illiegal token error.
Please help.
I created a custom button that should redirect to different apex page based on the record type.
Example: If record type = a then it should redirect to "abc" page otherwise "xyz" page
But when i click on the button i get illiegal token error.
{!REQUIRESCRIPT("/soap/ajax/23.0/connection.js")} {!REQUIRESCRIPT("/soap/ajax/23.0/apex.js")} var rtype; if({!Account.RecordTypeId} == "012G0000000nKI7") { rtype = "/apex/Newcase?"; } else { rtype = "/apex/oldcase?"; } window.top.location.href = rtype ;
Please help.
Have to put {!Account.RecordTypeId} in double qoutes
var url ;
if ("{!Account.RecordTypeId}" == "012G0000000nKI7") {
url = "/apex/Newcase?";
} else {
url = "/apex/oldcase?";
}
parent.location.href = url;
You just need to write down below code for your buttons's on click Javascript.
Here no need to include {!REQUIRESCRIPT("/soap/ajax/23.0/connection.js")} OR {!REQUIRESCRIPT("/soap/ajax/23.0/apex.js")} script files.
Thanks,
- thatherahere