Skip to main content
Conga Support

Replace Ampersands in Reference Field Data

Conga formula fields us ampersands (&) to identify parameters. If you reference fields that might contain ampersands or illegal characters as data values, you must replace the ampersands and illegal characters with a character string that Conga apps recognize as a substitute such as: “{~~~}”.

This function is useful for users who are replacing illegal characters with spaces or other legal characters but {~~~} does not turn into a "&" upon merge.

To replace ampersands in merge fields at runtime:

  1. Use the following string to replace ampersands within merge field values at merge time:

    SUBSTITUTE (fieldname, "&", "{~~~}" )

This formula field references the Account Name field in the OFN (output file name) parameter:

"&OFN=" + Account.Name + "Case+Review"

Since some Account Names might contain an ampersand, you should replace the ampersands like this:

"&OFN=" + SUBSTITUTE (Account.Name, "&", "{~~~}" ) + "Case+Review"

In the example below, the Account.Name field for the merged record contains the company name of Merging & Batching Inc. The merge fails without substituting the ampersands within field values. With the string to substitute ampersands at merge time, however, the merge is successful, as shown in the table below:

 

Incorrect

Correct

Input

"&OFN=" + Account.Name

"&OFN=" + SUBSTITUTE (Account.Name, "&", "{~~~}" )

Result

ERROR

Merging & Batching Inc.