> For the complete documentation index, see [llms.txt](https://help.sdocs.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://help.sdocs.com/sdocs/advanced-template-logic/conditional-logic/handle-escaped-characters-in-render-statements.md).

# Handle Escaped Characters in RENDER Statements

When using merge fields inside a render, if the merge field pulls in either `<` or `>`, the render will not properly work. This is because when the merge field pulls in `<` and `>` it pulls in the escaped version of these characters (`&lt;` `&gt;`). As of right now, we have a couple ways to work around this if it is needed.

### Workarounds

We currently have two workarounds that are confirmed to work.

{% stepper %}
{% step %}

#### Use replaceAll in the merge field

Use a replace all in the merge field replacing the escaped characters with nothing and updating the matching statement in the render to not include `<` or `>`.

Example:

{% code title="Example 1" %}

```
<!--RENDER='{{!Opportunity.nextstep replaceAll="&lt;, ,&gt;, "}}' != 'a href="/" target="_blank" /a'-->{{!Opportunity.nextstep}}<!--ENDRENDER-->
```

{% endcode %}
{% endstep %}

{% step %}

#### Use a named query to pull the data ahead of time

Use a named query to pull the data ahead of time and use the results from the named query in the render. This will avoid the characters getting escaped.

Example:

{% code title="Example 2" %}

```
<!--{{!<LineItemsSOQL>
<class>none</class>
<queryname>myQuery1</queryname>
<soql>
SELECT count(id) cid
FROM opportunity
where id = '{{!opportunity.id}}' and New_Line_Test__c = 'Test: <'
</soql>
</LineItemsSOQL>}}-->{{!myQuery1.cid}}<br />
<br />
Render Text if: <!--RENDER= {{!myQuery1.cid}} > 0 -->RENDER TEXT HERE <!--ENDRENDER-->
```

{% endcode %}
{% endstep %}
{% endstepper %}


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## 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, and the optional `goal` query parameter:

```
GET https://help.sdocs.com/sdocs/advanced-template-logic/conditional-logic/handle-escaped-characters-in-render-statements.md?ask=<question>&goal=<endgoal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is optional and describes the broader end goal you are ultimately trying to accomplish on behalf of the user. GitBook uses it to tailor the answer towards what is most useful for that goal.

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.
