The REPLACE parameter replaces text in a Salesforce field value with other text when the document is generated. Use it to format, mask or clean field values on the fly. The data in Salesforce doesn't change.

Syntax

{{REPLACE:Object.Field:FindText:ReplacementText}}

Values

ComponentEffect
Object.FieldThe field whose value you want to change, for example Account.Type.
FindTextThe text to replace. Use a token for special characters.
ReplacementTextThe new text. Use a token for special characters.

Supported tokens:

TokenCharacter
{COMMA},
{COLON}:
{SPACE}(space character)
{NEWLINE}Line break
{PERIOD}.
{SEMICOLON};

Where to add it

Type the REPLACE merge field in your Word template where you want the changed value to appear.

Example

Use caseSyntaxValueOutput
Replace "Private" with "Confidential"{{REPLACE:Account.Type:Private:Confidential}}PrivateConfidential
Replace comma with space in name{{REPLACE:Account.Name:{COMMA}:{SPACE} }}Acme, Inc.Acme Inc.
Replace semicolon with colon{{REPLACE:Account.Industry:{SEMICOLON}:{COLON} }}Technology;ServicesTechnology:Services

Works in

The examples on this page use a Word template.

Common errors

  • Formatting errors when the tag ends with a token. Add a space before the closing braces, as in {{REPLACE:Case.Description:{PERIOD}:{NEWLINE} }}.
  • A comma, colon or space isn't replaced. Type special characters as tokens, such as {COMMA}, not as the character itself.
  • An error names the field. The field name is wrong or you can't see the field. See DME-SF-002 and Merge fields are blank or show their tags.