1

I have a custom Javascript button on the Case object that creates an Opportunity. I am getting the error:

"A problem with the OnClick JavaScript for this button or link was encountered: missing ) after argument list"

The error message occurs when the Contact record Name includes a single quote (e.g., D'Ambro). Does anyone know what I can do to fix?

{!REQUIRESCRIPT("/soap/ajax/36.0/connection.js")}
if (typeof(srcUp) == 'function')
{
srcUp('/006/e?retURL={!Case.Id}&accid={!Account.Id}&RecordType=012a0000001Fsxa&opp11=Quote&00Na000000BODU0=Small Quote&opp3={!Case.Account} - Quote&opp9={!TODAY()+30}&CF00Na000000BAz6W={!Case.Contact}&ent=Opportunity');
}
else
{
window.open('/006/e?retURL={!Case.Id}&accid={!Account.Id}&RecordType=012a0000001Fsxa&opp11=Quote&00Na000000BODU0=Small Quote&opp3={!Case.Account} - Quote&opp9={!TODAY()+30}&CF00Na000000BAz6W={!Case.Contact}&ent=Opportunity');
}
1

Take a look at this documentation:

JSENCODE

Encodes text and merge field values for use in JavaScript by inserting escape characters, such as a backslash (\), before unsafe JavaScript characters, such as the apostrophe (').

Try updating your {!Case.Contact} references to "{!JSENCODE(Case.Contact)}" in your window.open and srcUp method.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.