# Escape an Apostrophe Correctly in a Merge Field

Escaping special characters in a merge field is important. Apostrophes are one of the most common special characters to be pulled in to a merge field. If you have a field that may pull in an apostrophe, the non-escaped apostrophe will break the merge field. In order to escape an apostrophe, you must add the following to the merge field:

{% hint style="info" %}
`replaceAll="',\\'"`
{% endhint %}

![blue book](https://pf-emoji-service.prod-east.frontend.public.atl-paas.net/assets/standard/ef8b0642-7523-4e13-9fd3-01b65648acf6/32x32/1f4d8.png) Example

{% code title="SOQL example" %}

```sql
SELECT Id FROM redwing__Achievement_Assignment__c
WHERE (redwing__Achievement_Assignment__c.achievement_type__c = 'Certifications' 
OR Achievement_Type__c = 'CEU') 
and redwing__Achievement_Assignment__c.redwing__status__c = 'Acquired' 
and ILT_Class__r.name = '{{!redwing__Achievement_Assignment__c.ILT_Class__r.name replaceAll="',\\'"}}'
 AND ID = '{{!ObjectID15}}'
```

{% endcode %}


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://help.sdocs.com/sdocs/template-architecture/inserting-merge-fields/additional-resources/escape-an-apostrophe-correctly-in-a-merge-field.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
