Loading
Agentforce and Einstein Generative AI
Conditional Logic Example Templates (Beta)

Conditional Logic Example Templates (Beta)

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

Required Editions

Available in: Lightning Experience
Available in: Enterprise, Performance, and Unlimited Editions with the Einstein for Platform, or Einstein or Agentforce for Sales or Service add-on, or Agentforce Foundations
Important
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 do not match each condition before you activate the template. To add a conditional block, see Add Conditional Logic to a Prompt Template (Beta).

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 content.

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

In the else branch, enter this content.

Summarize the case for routine follow-up.

If the prompt template uses Jinja, this is the equivalent template body. Do not 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 content.

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

In the else branch, enter this content.

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. Do not 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 content.

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 content.

Generate a standard priority summary.

Click Add Else. In the else branch, enter this content.

Generate a routine summary.

If the prompt template uses Jinja, this is the equivalent template body. Do not 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 %}
 
正在加载
Salesforce Help | Article