function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Matthew SchetselaarMatthew Schetselaar 

Escape Character for Custom Console button

I've got a custom button that Executes JavaScript to open a new tab in the console or open an external page if not in the console.  It is working pretty good but I've named the console tab with the Account Name.  It works fine unless there is an apostraphe or other escape character.  Is there a way to either comment the apostraphe out or ignore it or something?

Here is the button code:

{!requireScript("/support/console/29.0/integration.js")}

if (typeof(srcUp) == 'function') {
sforce.console.getEnclosingPrimaryTabId(function openSubtab(result){sforce.console.openSubtab(result.id, 'https://www.outsidelink.com', true, 'Admin for {!Account.Name}');});
} else {
window.open('https://www.outsidelink.com}');
}
Vinita_SFDCVinita_SFDC
Hi,

Try out following options:

1) Use replace function 
2) Use Substitute function
3) Use JSEncode

For code samples please refer following :

https://developer.salesforce.com/forums?id=906F00000009C6rIAE

http://salesforce.stackexchange.com/questions/38464/escaping-characters-within-ampscript-javascript-hybrid

https://www.salesforce.com/us/developer/docs/pages/Content/pages_security_tips_scontrols.htm