1

I'm attempting to pre-populate data into a visualforce page utilizing a custom button. In my use case, this is DocuSign custom button logic.

I will be providing Salesforce merge fields as well as text strings.

I've successfully coded URLENCODE in addition with JSENCODE so i do not receive any syntax errors from merged data. However, in my fields and text strings with apostrophe's, it adds a backslash in front \'.

Below is an example of one of my variables:

CES="{!URLENCODE(JSENCODE(Account.Name))} {!URLENCODE(JSENCODE(Opportunity.Name))} - eSignature";

My Account Name in Salesforce = "Dunder Mifflin's".

In the visualforce page it is displayed as "Dunder Mifflin\'s"

Is there any way to ENCODE the apostrophe, but still keep the format the same without the backslash?

Thanks in advance.

WTP API
  • 546
  • 3
  • 16

1 Answers1

1

Why do you use 2 encoding functions? Sounds like one would be enough. If there are two - well yeah, your output will be double-escaped.

Also if that link is being built on Visualforce page then you can build it in more elegant way and let Visualforce engine figure out the escaping for you:

<apex:page standardController="Account">
<apex:outputLink value="http://google.com/search">
    Search Google Images
    <apex:param name="q" value="{!account.name}"/>
    <apex:param name="tbm" value="isch"/>
</apex:outputLink>
</apex:page>

gives me

http://google.com/search?q=Dunder%20Miffin%27s&tbm=isch

eyescream
  • 18,088
  • 2
  • 34
  • 46