Sub topic 9
Choosing the right template type for a scenario
This chapter assumes you know the four template types (Sales Email, Field Generation, Record Summary, Flex) and how merge fields ground a prompt. Here you will turn a business scenario into a template type choice.
Start with two questions
Each type is defined by where its output appears and what its input is. Ask these in order:
- Where does the generated text need to go? It might go into an email draft, into a field on a record, onto a record page as a summary, or somewhere else, such as a flow or an Apex call.
- What input does the prompt need? It might need one record from a single object, or several inputs of mixed kinds.
The first question usually decides it.
The four choices
| Template type | Output goes to | Input | Typical use |
|---|---|---|---|
| Sales Email | An email composer | Contact or Lead, plus related records | Follow-ups, outreach |
| Field Generation | A text field on a record | The record the field belongs to | Descriptions, drafted field values |
| Record Summary | A record page | One record and its related data | Case or account summaries |
| Flex | Wherever you invoke it | Inputs you define yourself | Anything the other types do not cover |
Prefer a specialized type when one fits. It brings the matching input and the place where users see the result. Choose Flex when no specialized type fits or when you need inputs the others do not offer.
Worked scenarios
A rep wants a follow-up email after a meeting. The output is an email and the recipient is a Contact. Use Sales Email.
Write a short, friendly follow-up email to {!$Input:Contact.FirstName} {!$Input:Contact.LastName}, who works at {!$Input:Contact.Account.Name}.
Mention that we met recently and offer to schedule a call.
Keep it under 120 words and do not invent product details.Account records need a one-sentence description in a custom field. The output is stored in a field, and the input is the same record. Use Field Generation.
Using the information below, write a one-sentence description of this account for a sales rep.
Account name: {!$Input:Account.Name}
Industry: {!$Input:Account.Industry}
Annual revenue: {!$Input:Account.AnnualRevenue}
If a value is empty, leave it out instead of guessing.A support manager wants a quick read on a case. The output is a summary shown on the record page. Use Record Summary. You can also write this prompt in a Flex template whose input is a Case record. In that case the input name sets the merge field syntax.
Summarize this case for a support manager in three bullet points: the problem, what has been tried, and the next step.
Subject: {!$Input:Case.Subject}
Description: {!$Input:Case.Description}A flow must classify an incoming request using a record and some free text. The output feeds automation, and the input mixes a record with text. No specialized type fits, so use Flex.
Decision flow
Common mistakes
- Using Flex for everything. It works, but you lose the built-in placement of the specialized types, and you must set up the inputs and invocation yourself.
- Forcing a specialized type onto a multi-object problem. If the prompt needs inputs that the type's base object cannot supply, switch to Flex.
- Choosing by wording rather than by output. A prompt that "summarizes" can belong in any type. Where the result appears decides the type.
Exercise
Exercise
A service team wants a draft of a case-closing note stored in a custom text field on the Case record. Which template type fits, and why?
Show answer
Field Generation. The output is saved in a field on a record, and the input is that same Case record, so the merge fields come from Case. A Record Summary would only display text on the page, and Sales Email would send it to a composer.
Exercise
An Apex class must send an Account record plus a free-text note to a prompt and use the answer in code. Which type should you use?
Show answer
Flex. It lets you define the inputs yourself, including a record and free text, and it can be invoked from Apex.