Sub topic 3
The prompt template types at a glance
This chapter assumes you know what a prompt template is and what it contains, as covered in the previous chapter. It also assumes you are comfortable with Salesforce objects, records and fields. Here you get a map of the four template types. Later chapters cover each type in detail.
Why there are several types
Every prompt template holds instructions for a large language model (LLM) and some data to ground those instructions. The types differ in three things:
- What the template is bound to, such as a specific object or nothing in particular.
- Where the output can appear in Salesforce.
- How the merge fields are written.
When you create a template in Prompt Builder, you pick the type first. The type sets which inputs you can add and which tools can run the template.
The four types
Sales Email drafts an email to a person. It is based on a recipient record, usually a Contact or Lead, and can pull in related data such as the Account. The result appears as a draft that a user reviews and edits before sending.
Field Generation writes text into a single field on a record. You bind it to an object, and the generated text is offered to the user for the field that uses the template. A typical case is a description field filled from other fields on the same record.
Record Summary condenses one record, for example a Case or an Opportunity, into a short summary. The result is shown to the user on the record. It is meant for reading, not for saving to a field.
Flex is not tied to one object. You define the inputs yourself, and an input can be a record, text or other data. Because the inputs are yours, you can combine several sources in one prompt. Flex templates are mainly run from automation or code.
Side-by-side comparison
| Type | Bound to | Typical output location | Typical use |
|---|---|---|---|
| Sales Email | Recipient record (Contact or Lead) | Email composer | Follow-ups, outreach |
| Field Generation | One object | A field on the record page | Descriptions, drafted text |
| Record Summary | One object | The record page | Case or deal summaries |
| Flex | Inputs you define | Wherever the caller sends it | Custom scenarios, automation |
How the input name shapes the merge field
All four types use the same merge field pattern, {!$Input:...}. What comes after $Input: is the name of the input. In the object-bound types, the input is the record, so you write {!$Input:Contact.FirstName} or {!$Input:Account.Industry}. In a Flex template, the input you define sets that name. If you add a Case record input called Case, you write {!$Input:Case.Subject}.
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}This prompt works in a Record Summary template based on Case. It also works in a Flex template that has a Case input. The text is the same, and the template type decides how it can be run.
Common mistakes
- Picking Flex for everything. Flex is the most open type, but the object-bound types give you a built-in place in the user interface, such as the email composer or the record page.
- Expecting a Record Summary to write into a field. A summary is shown to the user. Writing into a field is the job of Field Generation.
- Assuming the merge field name is fixed. In Flex, the name comes from the input you define, so a mismatch leaves the merge field unresolved.
- Treating the type as changeable later. Choose the type before you write the prompt text, because the available inputs depend on it.
Exercise
A support team wants a one-paragraph recap of a Case, visible to an agent who opens the record. Which template type fits best, and what would the merge field for the case subject look like?
Show answer
Record Summary, because the output is a read-only summary shown on the record. The merge field is {!$Input:Case.Subject}. A Flex template with a Case input would also work, but it would need to be run from automation or code.
Exercise
Which type would you use to draft text into a description field from other fields on the same Account?
Show answer
Field Generation, because it is bound to an object and its output goes into a field.