Sub topic 3
The prompt template types at a glance
This chapter gives you a map of the four prompt template types in Salesforce Prompt Builder. Later chapters cover each type in detail. Here you learn what separates them and which question to ask first when you start a new template.
It assumes you know Salesforce objects, records, fields and relationships. It also assumes you can move around Setup and Lightning Experience, and that Einstein generative AI is enabled in your org, since Prompt Builder depends on it. You should have a general idea of what a prompt is.
Why there is more than one type
A prompt template is a reusable prompt stored in Salesforce. It can contain placeholders that are filled with real data when the template runs. A template type decides three things:
- What the template is based on, for example a Contact record, an Account record, or inputs you define yourself.
- Where the template can be used, for example in an email composer or on a record page.
- What the output is meant to be, for example an email draft, a field value, or a summary.
The type is chosen when you create the template. It sets the available inputs and the places the template can be used. If you pick the wrong type, you usually have to build a new template. You can't easily convert the old one, so spend a minute on the choice.
The four types
Prompt Builder offers these types:
- Sales Email
- Field Generation
- Record Summary
- Flex
The first three are object-bound. Each is tied to a specific Salesforce object, and the record that object represents supplies the data. Flex is the exception. You define its inputs yourself.
Sales Email
A Sales Email template drafts an email to a person. It is based on a Contact or Lead record. The prompt can use fields from that record and from related records, such as the Contact's Account.
The output is a draft that appears in the email composer, where a user reviews and edits it before sending. The template does not send anything on its own.
A Sales Email prompt looks like this:
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.The three merge fields are placeholders. At run time, Salesforce replaces them with the real values from the selected Contact. {!$Input:Contact.Account.Name} follows a relationship from the Contact to its Account.
Field Generation
A Field Generation template fills in one field on a record. It is based on an object, and the prompt can draw on other fields on the same record. The output is a value for a field, so it must suit that field. A short description fits a text field. A long essay does not.
The generated value appears on the record page, where the user can review it and save it. Setting this up involves placing the field on a Lightning record page, and the field's data type has to be one that accepts generated text. The Field Generation chapter covers the setup.
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 last line is a good habit in any template. Records often have empty fields, and without an instruction the model may invent a value to fill the gap.
Record Summary
A Record Summary template condenses a record into a short summary. It is based on an object, and it can use the record's fields and related information. The output is read by a person who wants the key points without opening every field and related list. It is not meant to fill a field or to be sent anywhere.
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 names its output format (three bullet points) and what each point should cover. A summary prompt without that structure tends to produce a different shape each time.
Flex
A Flex template is not tied to one object. You define the inputs yourself. An input can be a record, and you can add more than one. Because you choose the inputs, a Flex template can cover cases the other three do not, such as a prompt that uses both a Case and an Account, or one that does not start from a single record at all.
The name you give an input sets the merge field syntax. If you add an input named Case and base it on the Case object, you write {!$Input:Case.Subject}. The summary prompt shown above works as a Flex template for that reason. The same text works in a Record Summary template, where the object is fixed by the type. In a Flex template, the input you define supplies the object.
Flex templates are also the type you invoke from automation. The activation chapter covers that.
Comparing the types
| Type | Based on | Typical output | Where the output appears |
|---|---|---|---|
| Sales Email | Contact or Lead | Email draft | Email composer |
| Field Generation | An object you choose | Text for one field | Record page |
| Record Summary | An object you choose | Summary of a record | Record page and other places that support it |
| Flex | Inputs you define | Any text | Wherever the template is invoked |
Treat the "where the output appears" column as a starting point. Salesforce adds invocation options over time, so check the current documentation for your release.
What all types share
The types differ in their inputs and outputs, but the parts of a template are the same:
- A name and a description, so people can find the template later.
- The prompt text, which is the instruction sent to the model.
- Resources, which are the merge fields and other data you insert into the prompt.
- A model, which is the large language model that processes the prompt.
- Versions, so you can change a template without losing earlier work.
Every template also passes through the Einstein Trust Layer when it runs. This is true for all four types. The Trust Layer chapter covers what it does.
Grounding in each type
Grounding means giving the model real data from your org so it does not have to guess. In a template, you ground a prompt with merge fields and other resources.
All four types support grounding, but the data you can reach depends on the type:
- In an object-bound type, the base record is available automatically. You can also reach fields on related records through relationships, as in
Contact.Account.Name. - In Flex, only the inputs you defined are available. If the prompt needs an Account and you did not add an Account input, there is nothing to merge.
This makes the type choice a data decision as well. Before picking a type, list the records your prompt needs. If one record, or a record reachable by relationship, is enough, an object-bound type may work. If you need several unrelated records, Flex fits better.
Common mistakes when choosing a type
These errors come up often:
- Using Flex for everything. Flex is flexible, but it gives you less built-in structure than an object-bound type. If the task is "draft an email to a Contact," Sales Email already provides the right base and the right place for the output.
- Using Field Generation for output that is not a field value. If the output is a long explanation for a person to read, a Record Summary or Flex template is a better fit. Field Generation output should match the target field.
- Treating Record Summary as a report. A summary is a model's condensed reading of the record. It is not a calculation. If a number must be exact, write a formula or report for it and pass the result in, rather than asking the model to add things up.
- Forgetting empty values. All types merge whatever is in the record. If a field is blank, the prompt receives a blank. Tell the model what to do in that case, as the Field Generation example does.
- Expecting the email to send itself. A Sales Email template produces a draft. A person reviews it.
A quick decision order
When you start a new template, ask these questions in order:
- Is the output an email to a Contact or Lead? If yes, use Sales Email.
- Is the output the value of one field on a record? If yes, use Field Generation.
- Is the output a short summary of one record? If yes, use Record Summary.
- Does the prompt need several records or custom inputs, or will it run from automation? If yes, use Flex.
If more than one answer is yes, prefer the most specific type that fits. Choosing among them in more depth is the subject of a later chapter.
Exercise
A support team wants a prompt that reads a Case and its related Account and produces a short internal briefing for a manager. Which template type fits best, and why might Record Summary not be enough?
Show answer
Flex fits best. The prompt needs two records, a Case and an Account, and a Flex template lets you define both as inputs, for example with merge fields like {!$Input:Case.Subject} and {!$Input:Account.Name}. Record Summary is based on one object. If the Account is reachable from the Case through a relationship, a Record Summary could still work. If the briefing needs independent inputs, Flex is the safer choice.
Exercise
You write a Field Generation prompt that includes {!$Input:Account.AnnualRevenue}. Some accounts have no revenue value. What should you add to the prompt, and why?
Show answer
Add an instruction such as "If a value is empty, leave it out instead of guessing." Without it, the model receives a blank and may invent a plausible figure to fill the gap.