Prompt Builder
Learn how Prompt Builder creates reusable prompt templates, which template type to choose, and how to connect templates to flows and automation.
- Learning Outcomes
- Prompt Builder Overview
- Prompt vs Prompt Template (and Grounding)
- Prompt Template Workspace (Draft + Preview)
- Prompt Template Types (Quick Guide)
- How Templates Are Used (Email, Fields, Summaries, APIs)
- Prompt Templates + Flows (Two Key Methods)
- Scenarios & Solutions (Exam-style)
- Describe how to use Prompt Builder to create prompt templates for AI-generated responses.
- Identify prompt template types available in Prompt Builder.
- Explain how templates are used and key considerations when invoking them with flows.
- Choose the right Prompt Builder approach to meet a business requirement.
Introduction
Prompt Builder lets you create reusable prompt templates that instruct large language models (LLMs) to generate consistent, high-quality responses. Templates are designed to be repeatable, testable, and grounded in Salesforce data using merge fields.
You’ll see Prompt Builder used for common outcomes like drafting sales emails, generating text for record fields, summarizing records, and powering custom experiences through flows and invocable actions.
Step 1: Prompt vs Prompt Template (and Grounding)
A prompt is the instruction set you send to the model. Output quality depends heavily on design: clarity, constraints, and guidance.
A prompt template is a managed, reusable version of a prompt—built for a specific business outcome and often grounded with data.
Grounding (Non-negotiable for quality)
Grounding adds relevant data (like record fields, knowledge, or interaction context) so the response is personalized and accurate. In Prompt Builder, grounding is commonly done using merge fields/resources.
Step 2: Prompt Template Workspace (Draft → Preview)
The Prompt Template Workspace is where you draft the prompt, add merge fields/resources for grounding, and test results before publishing.
Draft
- Write clear instructions (goal, constraints, tone)
- Add guidelines (format, length, style)
- Ground with merge fields/resources
Preview
- Resolution: shows resolved prompt + grounded data
- Response: shows the generated output
- Test with real records (Save & Preview)
Step 3: Access & Permissions (Who can build vs run)
Prompt Builder access depends on enabling Einstein Generative AI and assigning permission sets that match the user’s responsibilities.
Prompt Template Manager
Create and manage prompt templates in Prompt Builder (builders/admins).
Prompt Template User
Access and run prompt templates (end users).
Step 4: Prompt Template Types (Choose by Outcome)
The fastest way to choose the right template type is to ask: Where will the output appear? (email composer, record field, summary panel, custom UI, service replies, etc.)
🧩 Field Generation
Generates content for a record field in Lightning. Users click an icon next to a dynamic form field to populate it.
Best for: editable AI text in-page (human-in-the-loop).
✉️ Sales Email
Generates personalized sales emails grounded in record data. Used from the email composer via Draft with Einstein.
Best for: email drafts with consistent tone + personalization.
📝 Record Summary
Summarizes record data for a quick, comprehensive view. Often used by summary actions (including agent summaries).
Best for: consistent summaries across users/teams.
⚙️ Flex
A “do anything” template for unique business use cases not covered by other types. Define resources and inputs.
Best for: proposals, multi-object outputs, custom experiences.
💬 Service Replies (Contextual / Grounded)
Tailors customer support replies for live chat/messaging—either context-aware or grounded in knowledge/case history.
Best for: support messaging with brand voice + policy grounding.
📚 Knowledge Answers
Customizes how answers are generated from Knowledge (tone, included info, formatting).
Best for: consistent knowledge-based answers at scale.
Step 5: How Prompt Templates Are Used
How you run a template depends on the template type and where you need the output.
In the UI
- Sales Email: Draft with Einstein in email composer
- Field Generation: icon next to a dynamic form field
- Record Summary: summary views/actions
In automation / integration
- Flow: Prompt Template flow action
- Invocable action: call from workflows
- API/Apex: Connect REST API or Connect in Apex
Step 6: Prompt Templates + Flows (Two Methods)
Flows can either invoke a prompt template or feed dynamic instructions/data into a template.
Method A: Prompt Template Flow Action
Add the Prompt Template action to a flow to generate a response using a selected template and inputs. (Template must have an active version.)
Method B: Template-Triggered Prompt Flow
Use a template-triggered prompt flow to run logic and send “prompt instructions” into the template via a flow merge field. Great when you need dynamic data shaping before generation.
Practice: Match the Requirement to Prompt Builder
These scenarios mirror how questions are written: identify the right template type and how it should be invoked.
Scenario: Unique business output (proposal-style)
A team needs an output that isn’t covered by standard template types—like generating a structured sales proposal using data from multiple objects.
Scenario 3: Personalized summaries on a contact record page
A hotel wants personalized guest summaries (interests and activity preferences) accessible on the contact record page only.
Scenario 4: Custom UX—user enters order number, sees summary
Users enter a sales order number and Salesforce should generate and display an order summary using a predefined prompt template.
Scenario 5: Human-in-the-loop editable descriptions
Leadership wants a dynamic form field auto-populated by AI, but easy for users to review and edit before finalizing (oversight + validation).
Scenario 6: Personalized marketing emails
A company wants marketing emails that highlight products aligned to each customer’s interests and preferences.
Next: Build Your First Template (Guided Lab)
Next, you’ll create one template end-to-end: choose the type, add grounding, test in Preview, and connect it to a flow or UI entry point.