Sub topic 9
Choosing the right template type for a scenario
You have met the four prompt template types in Prompt Builder: Sales Email, Field Generation, Record Summary and Flex. This chapter is about the decision. Given a business request, which type do you create, and how do you notice early that you picked wrong?
This chapter assumes you know how merge fields ground a prompt, what an object-bound template is, and the basics of Lightning record pages. It also assumes Einstein generative AI is already enabled in your org.
Why the type is a real decision
The template type is not a label. It controls three things:
- Inputs. The object-bound types are built on one record. A Flex template takes inputs you define.
- Where the output appears. Each type has a home in the user interface, or in automation.
- Who or what triggers it. A user clicking a button is different from a Flow running without anyone watching.
You choose the type when you create the template. Changing your mind later usually means building a new template and copying the prompt text across. Merge field syntax differs between types, so the copy needs fixing. Spending five minutes on the decision is cheaper than rebuilding.
The four types compared
| Type | Input | Where the output goes | Typical trigger |
|---|---|---|---|
| Sales Email | A recipient (Contact or Lead) and related records | A draft in the email composer | A user drafting an email |
| Field Generation | One record of a chosen object | A single field on that record | A user working on the record page |
| Record Summary | One record of a chosen object | A summary shown to the user | A user opening the record |
| Flex | Inputs you define, such as records or text | Wherever the caller sends it | Apex, Flow, or an agent action |
Check the current Salesforce documentation for the exact objects and surfaces each type supports. These change between releases. The pattern is stable: three types are tied to one record and one place in the UI, and Flex is the general-purpose type.
A decision procedure
Ask these questions in order. Stop at the first answer that fits.
- Is the result an email to a person? If a rep or agent will review and send it from the composer, use Sales Email.
- Does the result belong in one specific field on a record? If yes, use Field Generation.
- Is the result a read-only digest of one record? If yes, use Record Summary.
- Does the prompt need data from several unrelated records, free text, or a caller other than a person on a record page? Use Flex.
Question 4 is the catch-all. It also acts as an escape hatch when the first three almost fit but one requirement breaks them.
Worked scenarios
Scenario 1: follow-up after a meeting
A sales manager wants reps to send a friendly follow-up quickly, with the customer's name and company filled in.
This is an email, the recipient is a Contact, and a human reviews it. Use Sales Email. The grounding comes from the recipient and their account:
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.Notice the last line. The template can only ground what it has been given, so it tells the model not to fill gaps with invention.
Scenario 2: an account description field
Marketing wants every account to carry a one-sentence description, generated from existing fields.
The output is stored in one field on 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.The empty-value instruction matters here. Field values are often blank, and a field that is auto-filled with invented detail is worse than an empty one.
Scenario 3: a support manager's case digest
A manager opens a case and wants the problem, what was tried and the next step in three bullets.
The output is a read-only digest of one record, so Record Summary fits:
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}Scenario 4: the same digest, but from a Flow
Now the requirement changes. A Flow runs when a case escalates, builds the digest, and posts it to a Chatter feed or stores it somewhere. No user is on a record page.
The prompt text can stay almost identical, but the type cannot. Record Summary is made to show a summary to a person looking at a record. A Flow needs a template it can call and receive text from. Use Flex with an input named Case whose type is a Case record. The input name sets the merge field syntax, so the prompt body above works only if the input is called Case:
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}If you named the input SupportCase, the merge fields would be {!$Input:SupportCase.Subject}, and the old text would not resolve.
Scenario 5: comparing an account with an open opportunity
A user wants a briefing that uses an Account, a specific Opportunity and some free text typed in by the rep, such as "focus on renewal risk".
No object-bound type takes this mix of inputs. Use Flex with three inputs: an Account record, an Opportunity record and a text input. This is the typical case where Flex is the correct choice, not a workaround.
Trade-offs between Flex and the object-bound types
Flex can do almost anything the others do, so you might be tempted to use it everywhere. Weigh it against the specialized types.
| Concern | Object-bound types | Flex |
|---|---|---|
| Setup effort | Low. The record and the UI location are already decided. | Higher. You define inputs and wire up the caller. |
| Out-of-the-box UI | Yes. The composer, field or summary surface is provided. | No. You decide where the output goes. |
| Input flexibility | One main record plus its related data | Several records and text inputs |
| Automation | Limited by design | Built to be called from Flow, Apex and agent actions |
| Risk of misuse | Low | Higher, because nothing guides the design |
Prefer the specialized type when it fits. The built-in surface means less to build and fewer places to break. Choose Flex when a requirement does not fit the other three, not because it feels more powerful.
Edge cases and common mistakes
- Using Field Generation for a long, multi-part output. A field has a data type and a length. A Text field or a Long Text Area can hold different amounts, so confirm the target field can hold what the prompt produces. If you want a three-paragraph briefing, use Record Summary or Flex.
- Using Record Summary when the result must be saved. A summary is for reading. If it has to persist on the record, use Field Generation, or a Flex template called from automation that writes the result.
- Using Sales Email for a non-email channel. The output lands in an email draft. If you want a text message or an internal note, use Flex.
- Mismatched merge field names after moving a prompt. The same sentence, copied from a Record Summary into a Flex template, breaks if the input name is different. Preview after every move.
- Assuming related data is always available. Merge fields on a related record, such as
Contact.Account.Name, return a value only if the relationship is filled in. Plan for empty values in the prompt wording. - Over-grounding. Adding every field from an object makes prompts long and noisy. Include the fields the model needs to do the task. Anything else is extra input that might leak into the output.
A short checklist before you create the template
- Write the requirement in one sentence that names the output and the person or process that consumes it.
- Identify the inputs. Count the records and any free text.
- Decide where the output has to appear or be stored.
- Walk the decision flow in this chapter and note the type it gives you.
- Name any requirement that the type does not satisfy. If one is a hard requirement, move to Flex.
- Create the template, add grounding, and preview it with a real record before sharing it.
The chapters on testing and activation cover steps 5 and 6 in more detail. Here the point is to avoid starting in the wrong place.
Exercise
A Flow runs when an Opportunity is marked Closed Lost. It must ask the model for a two-sentence loss analysis based on the Opportunity and its Account, then store the text on a custom field. No user is on a record page. Which template type do you choose, and why not the object-bound types?
Show answer
Flex. The caller is automation, not a person on a record page, so there is no built-in surface for the output. Field Generation is tied to a user working on a record, and Record Summary is for showing a read-only summary. A Flex template takes the Opportunity (and Account) as inputs, the Flow calls it, and the Flow writes the returned text to the custom field.
Exercise
You wrote a Record Summary prompt that uses {!$Input:Case.Subject}. You recreate it as a Flex template and name the input SupportCase. The preview shows blank values where the subject should be. What went wrong and how do you fix it?
Show answer
In a Flex template the input name sets the merge field syntax. With the input named SupportCase, the merge field must be {!$Input:SupportCase.Subject}. Either update the merge fields in the prompt to use SupportCase, or rename the input to Case so the original text resolves. Then preview again with a real record.