Skip to main content
I've got a double escape-character problem.  I have a custom Notes field in Salesforce, Type: Text Area

 

A field force can enter any notes they want to.  These notes can include the double quotes character ("), which they use to represent inches.

 

In a Mail Merge document, I use an IF statement to conditionally show these notes, and not display anything, even so much as a blank line, if the field hasn't been populated.  

 

Ex.)   {IF  {{OPPORTUNITY_OTHER_1_NOTES}} <> "" "Other Notes: {{OPPORTUNITY_OTHER_1_NOTES}}

 

(The IF statement in the Mail Merge document is necessary to suppress a blank line if there aren't any notes)

 

However, if the Salesforce Notes field contains double quotes, then you get an error when generating the PDF document using Conga Composer (Mail Merge thinks the field's quote character is ending the IF statement text).

 

Nuts.  Ok, soooo, just escape the double quotes character in the Mail Merge document, right?  Well, I can't figure out how to do that.  I've tried using the backslash (\"), but the PDF just gets generated with the backslash as one of the displayed characters.  I've tried "{ Symbol 147}", but it just outputs exactly that in the PDF.

 

Nuts.  Ok, soooo, I'll escape the character in Salesforce using a formula field, replacing the double quotes with two single quotes.  Unfortunately, the SUBSTITUTE operator in Salesforce surrounds the expected text in... double quotes.  So if you try to escape a double quote, you get an error when checking the syntax.

 

Surely, someone out there has had to escape double quotes in a Salesforce formula?  How does one do this?

 

Thanks!
4 réponses
  1. 18 mai 2017, 19:21
    Just so it's answered here you would need to use the backslah(\).  From Salesforce help: Use the backslash (\) character before a quote or backslash to insert it as a literal value in your output. For example, "Trouble\\Case \"Ticket\": " in your formula displays Trouble\Case "Ticket": on detail pages.

     

    This comes from another post by Marco B (https://success.salesforce.com/answers?id=90630000000gqZJAAY)
0/9000