Sub topic 1
What Prompt Builder Is and Why Templates Exist
Prerequisites
Assume you understand Salesforce objects, records, fields, and relationships. You should also know the basics of Lightning Experience and generative AI. Einstein generative AI must be enabled in the org.
What Prompt Builder Is and Why Templates Exist
Prompt Builder is Salesforce’s tool for creating reusable instructions for generative AI. A prompt template combines fixed instructions with Salesforce data. When someone or an automation invokes the template, Salesforce supplies the current data and sends the resulting prompt to a selected model.
Templates prevent users from rewriting prompts and help teams apply consistent rules. They also make prompts easier to test, version, activate, and reuse in Salesforce features such as email generation or record fields.
What a Prompt Template Contains
A template usually contains:
- Instructions that describe the task, audience, format, and limits.
- Inputs, such as a Contact, Account, Case, or another record.
- Merge fields that insert values from those inputs.
- Resources, such as related records or other Salesforce-provided context.
- Configuration for the model and generated output.
For example, a template can use the current Contact record:
Write a friendly follow-up email to {!$Input:Contact.FirstName}.
Keep it under 120 words and do not invent product details.The merge field is replaced with the Contact’s actual first name when the template runs.
The Prompt Template Types at a Glance
| Template type | Main purpose |
|---|---|
| Sales Email | Drafts personalized sales emails using customer and account data |
| Field Generation | Generates or updates a value in a single record field |
| Record Summary | Summarizes a record for a person who needs its key details |
| Flex | Supports flexible inputs and output uses beyond the object-bound types |
Sales Email, Field Generation, and Record Summary templates are tied to a Salesforce object and its expected use. A Flex template is more adaptable. It can accept configured inputs, such as records or text, and can be invoked by different Salesforce experiences or automation.
Grounding Prompts with Merge Fields and Resources
Grounding means giving the model trusted context so it can base its answer on Salesforce data instead of guessing. Merge fields provide specific values from records. Resources provide additional context selected for the template.
Tell the model what to do when data is missing. For example, use “leave it out instead of guessing.” This improves accuracy and reduces invented details.
Exercise
Which template type fits a prompt that creates a one-sentence Account description in an Account text field?
Show answer
A Field Generation template, because it generates a value for one field on the object-bound record.