---
schema_version: "1"
id: 08806d6afe4672b255f48ff6f4e1cc2b0ce3d37c042ac26beca411add2b68d21
title: Conditional Logic Example Templates
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ai/264-0-0/prompt_builder_conditional_logic_example_templates.md
canonical_url: https://help.salesforce.com/s/articleView?id=ai.prompt_builder_conditional_logic_example_templates.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: c306b7ef230009739c9b9e9f4f09490eaec3f72e069acc8ba958d953461bdc15
description: Copy these example conditional blocks into a prompt template that uses the Block Editor.
products:
  - Agentforce
  - Cross Cloud
release: "264"
---
# Conditional Logic Example Templates

Copy these example conditional blocks into a prompt template that uses the Block Editor.

### Required Editions

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Enterprise</strong>, <strong>Performance</strong>, and <strong>Unlimited</strong> Editions with the Einstein for Platform, or Einstein or Agentforce for Sales or Service add-on, or Agentforce Foundations</td></tr></tbody></table>

![Important](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ai-generative_ai-264-0-0-production-enus/f8ef6498-d7b2-44e3-9b34-ffd5a850aae9/images/icon_important.png)

Important The example templates contain placeholder text for prompt template resources. Before previewing the model’s response to an example template, replace each placeholder with a merge field.

Copy these examples into a prompt template that uses the Block Editor. Replace each merge field with a resource from the @ picker. Preview with sample records that match and don’t match each condition before you activate the template. To add a conditional block, see [Add Conditional Logic to a Prompt Template](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_add_conditional_logic.htm&release=264.0.0&type=5 "Use conditional blocks to create dynamic prompt templates that adapt based on your grounded data.").

## Vary a Case Summary by Priority

Prompt Template Type: Record Summary or Flex

Object: Case

Use this example to change tone when case priority is High.

This prompt template contains placeholder text for this merge field.

- `{!Case.Priority}`

In the Block Editor, add a conditional block. In the condition field, enter:

```
{!Case.Priority} == "High"
```

In the if branch, enter this text.

```
This case requires immediate attention. Summarize the issue with urgency and flag any SLA risk.
```

In the else branch, enter this text.

```
Summarize the case for routine follow-up.
```

If the prompt template uses Jinja, this is the equivalent template body. Don’t paste Jinja tags into the Block Editor condition field.

```
{% if Case.Priority == "High" %}
This case requires immediate attention. Summarize the issue with urgency and flag any SLA risk.
{% else %}
Summarize the case for routine follow-up.
{% endif %}
```

## Skip a Blank Email Address

Prompt Template Type: Sales Email or Flex

Object: Contact

Use this example to avoid addressing a blank email in a generated draft.

This prompt template contains placeholder text for this merge field.

- `{!Contact.Email}`

In the Block Editor, add a conditional block. In the condition field, enter:

```
{!Contact.Email}
```

In the if branch, enter this text.

```
Draft a follow-up email to the address in {!Contact.Email}.
```

In the else branch, enter this text.

```
No email is on file. Draft a note for the rep to collect contact information first.
```

If the prompt template uses Jinja, this is the equivalent template body. Don’t paste Jinja tags into the Block Editor condition field.

```
{% if Contact.Email %}
Draft a follow-up email to {{ Contact.Email }}.
{% else %}
No email is on file. Draft a note for the rep to collect contact information first.
{% endif %}
```

## Combine Priority and Account Type

Prompt Template Type: Flex

Objects: Case, Account

Use this example when you need more than one condition. Use `Account.Type`, not a custom tier field, unless your org has that field.

This prompt template contains placeholder text for these merge fields.

- `{!Case.Priority}`
- `{!Account.Type}`

In the Block Editor, add a conditional block. In the if condition field, enter:

```
{!Case.Priority} == "High" and {!Account.Type} == "Enterprise"
```

In the if branch, enter this text.

```
Generate an executive-ready summary for immediate leadership visibility.
```

Click **Add Else If**. In the else if condition field, enter:

```
{!Case.Priority} == "High" or {!Account.Type} == "Enterprise"
```

In the else if branch, enter this text.

```
Generate a standard priority summary.
```

Click **Add Else**. In the else branch, enter this text.

```
Generate a routine summary.
```

If the prompt template uses Jinja, this is the equivalent template body. Don’t paste Jinja tags into the Block Editor condition field.

```
{% if Case.Priority == "High" and Account.Type == "Enterprise" %}
Generate an executive-ready summary for immediate leadership visibility.
{% elif Case.Priority == "High" or Account.Type == "Enterprise" %}
Generate a standard priority summary.
{% else %}
Generate a routine summary.
{% endif %}
```

#### See Also

- [Salesforce AI Use Case Library](https://www.salesforce.com/artificial-intelligence/use-cases/)