> 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/enhanced-template-editor/conditional-logic-in-the-enhanced-editor.md).

# Conditional Logic in the Enhanced Editor

Conditional logic provides template authors with the ability to declaratively set visibility conditions for specific blocks of a template.

There are two primary applications of implementing conditional logic within a template:

* Applying conditions to a pre-existing block of text, that may or may not include variable data, within the template.
* Applying conditions to a published component template, which allows authors to maintain templates outside of parent template and call them in when generation conditions are met.

#### Apply Conditional Logic

To configure conditional logic for static text or text containing merge fields, follow these steps:

1. Highlight the text block or the component template placeholder within the template body.
2. Click the **Insert Conditional Logic** icon ![](/files/XJ5FBgoSnXY4ZUe0iwMn) to enable the *Visibility* panel.
3. Enter a descriptive name for the conditional block in the naming field to provide a clear reference for future template authors.
4. Select the + **Click to Add a Condition** button to open the *Add Visibility Condition* menu.
5. Select the specific field from the Salesforce Record that will drive the rule. Note: The picklist reveals all applicable fields based on the configured base record type of the template.
6. Select an operator to define the relationship.

{% hint style="info" %}
S-Docs supports the standard Salesforce operators, including:

* Equals (==)
* Not equals (!=)
* Greater than (>)
* Less than (<)
* Greater than or equal to (>=)
* Less than or equal to (<=)
* Contains
* Not contains
  {% endhint %}

7. Enter the target value in that the field must evaluate against the operator to trigger the condition.

<figure><img src="/files/MBrytmyp03lFQ3eeUwVD" alt=""><figcaption><p>Example of a text area configured with multiple conditional visibility criteria.</p></figcaption></figure>

{% hint style="info" %}
Pictured above: A visual indication, or highlight, is applied to template sections configured with conditional visibility rules so template authors can quickly navigate and easily maintain template rules.
{% endhint %}

#### Managing Multiple Conditions

When a content block requires multiple conditions, authors can configure how those rules are evaluated together using "and" or "or" logic. The enhanced template editor provides two straightforward options to handle multiple requirements:

* **All conditions are met:** The content will display only if every specified condition evaluates to true.
* **Any condition is met:** The content will display if at least one of the specified conditions evaluates to true.

<div align="left"><figure><img src="/files/zBJSWwNwOfAwkvBjXCz8" alt=""><figcaption></figcaption></figure></div>

{% hint style="warning" %}

#### Limitations

* Nested conditional logic is not supported in the current release. All active conditions follow the overarching rule selected for that block.
* In the current release, conditional logic cannot be applied to related lists. This functionality is strictly restricted to text blocks, variable merge fields, and component templates as outlined above.
  {% endhint %}


---

# 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/enhanced-template-editor/conditional-logic-in-the-enhanced-editor.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.
