Sub topic 1
What Prompt Builder is and why templates exist
Prerequisites
This chapter assumes you already know:
- Basic Salesforce concepts: objects, records, fields and relationships.
- How to move around Lightning Experience and Setup.
- What a generative AI prompt is, at a general level.
- That Prompt Builder only works in an org where Einstein generative AI is enabled. If you can't open Prompt Builder in Setup, ask an administrator to check this first.
You do not need to write code. Some examples use merge fields, which are placeholders that Salesforce fills with record data. They are explained below.
What Prompt Builder is
Prompt Builder is a Salesforce tool for creating, testing and managing prompt templates. You open it from Setup. A prompt template is a saved set of instructions for a large language model (LLM), plus placeholders for Salesforce data.
The tool is built around one idea: a prompt that is typed by hand every time is hard to repeat, review or improve. A template stores the prompt once, so the same prompt can be reused by many people and by automation.
Why templates exist
A typed prompt such as "write an email to this customer" has three problems in a business setting.
- No data. The model knows nothing about your customer. Someone has to copy values into the prompt, and that is slow and easy to get wrong.
- No consistency. Ten reps write ten different prompts and get ten different tones and lengths.
- No control. An admin can't test, version or turn off a prompt that lives only in someone's head.
A template addresses each problem:
| Problem | What a template adds |
|---|---|
| No data | Merge fields pull values from a record when the prompt runs |
| No consistency | One shared set of instructions, written once |
| No control | Preview, versions and an activation switch |
A first look at a template
Here is a small prompt that uses merge fields. Text in {!...} is replaced with real values from the record when the template runs.
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 first line grounds the prompt. Grounding means supplying the model with real data from your org so that it doesn't have to guess. The last line limits the output and tells the model not to make things up. The later chapters return to both ideas.
When the template runs for a contact named Dana Lee at Acme, the model receives the text with "Dana", "Lee" and "Acme" already in place.
How the pieces fit together
At run time, Salesforce takes the template, resolves its merge fields against a record, and sends the finished prompt to a model. The response is returned to wherever the template was invoked.
The Einstein Trust Layer sits between your org and the model. It applies data protection steps to prompts that come from templates. A later chapter covers it in detail.
Template types
Prompt Builder offers several template types. Each type is tied to a particular job and decides what input the template accepts and where the output appears.
- Sales Email drafts emails based on contact, lead or related records.
- Field Generation writes text into a field on a record.
- Record Summary summarizes a record.
- Flex takes flexible inputs that you define, so it is not tied to a single object in the same way.
The next chapters look at what a template contains, then at each type in turn. For now, remember that the type is a choice you make at creation, and it shapes everything after that.
Common mistakes at this stage
- Treating a template as a chat window. A template is a reusable asset. Write it so it works for any record of its type, not only the one you are looking at.
- Skipping grounding. A prompt without merge fields tends to produce generic or invented content.
- Assuming access is automatic. Prompt Builder needs Einstein generative AI enabled and the right permissions for the people who build templates.
Exercise
Name two problems that a prompt template solves compared with typing a prompt by hand each time, and say which template feature addresses each one.
Show answer
Any two of these. Missing data is solved by merge fields, which pull values from a record. Inconsistent output is solved by writing the instructions once and sharing them. Lack of control is solved by preview, versioning and activation.
Exercise
In the follow-up email prompt, which part is grounding, and why does it matter?
Show answer
The merge fields {!$Input:Contact.FirstName}, {!$Input:Contact.LastName} and {!$Input:Contact.Account.Name} are the grounding. They give the model real record values, so it does not have to guess names or invent details.