Salesforce Prompt Builder: Complete Guide to Prompt Templates (2026)
- December 5, 2026
- Posted by: SFDCGYM
- Category: Headless 360 ,
Salesforce Prompt Builder is the tool that lets admins and developers create reusable AI prompts, called prompt templates, that are grounded in real Salesforce data and protected by the Einstein Trust Layer. In this guide, you will learn what Prompt Builder is, the four main prompt template types, how grounding works with merge fields, Flow and Apex, and how to build your first template step by step.
Prompt Builder is also a core building block of Salesforce’s headless strategy. If you are new to that, read What Is Headless 360? first.
Table of Contents
- What Is Salesforce Prompt Builder?
- What Is a Prompt Template?
- Prompt Template Types
- How Prompt Templates Work: Grounding and the Trust Layer
- How to Create Your First Prompt Template
- Where You Can Use Prompt Templates
- Prompt Writing Best Practices
- Prompt Builder vs Agentforce
- Costs and Limitations
- Frequently Asked Questions
What Is Salesforce Prompt Builder?
Salesforce Prompt Builder is a no-code tool in Setup where you design, test and activate prompts for large language models (LLMs). Instead of every user typing their own prompt into a chatbot, an admin builds one well-tested prompt once, and everyone uses it inside their normal Salesforce work.
Three things make Prompt Builder different from using a public AI chat tool:
- It uses your data. Prompts pull live values from records, related lists, flows, Apex and Data 360.
- It is reusable. One template can serve thousands of users and records.
- It is secure. Every prompt goes through the Einstein Trust Layer before it reaches the LLM.
What Is a Prompt Template?
A prompt template is a saved prompt with placeholders. At run time, Salesforce fills the placeholders with real data, sends the finished prompt to the LLM and returns the answer. Every template has five parts:
- Type: decides where the output is used, such as an email, a field or a summary.
- Instructions: the plain-language text that tells the AI what to do.
- Inputs: the record or records the template works on, such as an Account or a Contact.
- Resources: merge fields, related lists, flows, Apex or Data 360 data that ground the prompt.
- Model: the LLM that generates the response.
Here is a simple example of template instructions. The parts in curly brackets are merge fields that Salesforce replaces with real values:
You are a helpful sales assistant. Write a short summary of the account {!$Input:Account.Name} in the {!$Input:Account.Industry} industry. Use the recent activities below. Keep it under 100 words and end with one suggested next step.
{!$Flow:Get_Recent_Activities.Prompt}
Prompt Template Types in Prompt Builder
The template type you choose decides where the AI output appears. These are the four main types:
| Type | What it does | Best for |
|---|---|---|
| Sales Email | Drafts personalized emails for a contact or lead using record data | Sales follow-ups, event invites |
| Field Generation | Fills a field on a Lightning record page with AI-generated text | Account summaries, case descriptions |
| Record Summary | Creates a rich-text summary of a record | Quick record overviews, agent answers |
| Flex | Any custom use case with inputs you define | Newsletters, product descriptions, custom actions |
Salesforce also ships ready-made standard templates for specific clouds, such as case summaries and knowledge answers for Service Cloud. You can customize many of these instead of starting from scratch.
Tip: if no other type fits, choose Flex. It is the most flexible type and the only one that can be shared with external AI tools as an MCP prompt (more on that below).
How Prompt Templates Work: Grounding and the Einstein Trust Layer
Grounding means giving the AI real facts from your org, so it answers based on your data instead of guessing. Grounding is what stops most hallucinations. Prompt Builder offers four grounding options:
- Merge fields: insert values from the input record, like Account Name or Case Subject.
- Related lists: include child records, such as open opportunities on an account.
- Flow: build a Template-Triggered Prompt Flow to query and filter data with clicks, then insert its output into the prompt.
- Apex: write an invocable method for complex logic or real-time data from an external API.
Data 360 data can also be used for grounding, which is useful when customer information lives outside your CRM. Learn more in our guide to Identity Resolution and Unified Profiles.
After grounding, the prompt passes through the Einstein Trust Layer. The Trust Layer can mask sensitive data, check responses for toxicity and keep an audit trail. Its zero data retention agreements with model providers mean your prompt data is not stored or used to train the external model.
How to Create Your First Prompt Template (Step by Step)
Let’s build a simple Field Generation template that writes an account summary. Exact labels can vary slightly by release, but the flow is the same:
- Open Prompt Builder. In Setup, type “Prompt Builder” in Quick Find and open it.
- Click New Prompt Template. Choose Field Generation as the type.
- Name it and pick the object and field. For example, Account and a custom long text field called “AI Summary.”
- Write the instructions. Tell the AI its role, its task, the format and the length.
- Insert resources. Use the resource picker to add merge fields like Industry and Annual Revenue, or a flow for recent activities.
- Preview with a real record. Pick an account and check both the resolved prompt and the AI response.
- Refine and save. Adjust the wording until the output is consistent, then save and activate the template.
- Add it to the record page. In Lightning App Builder, select the field on the page and connect it to your prompt template. Users can now generate the summary with one click.
Always test in a sandbox first and preview with several different records, not just one perfect example.
Where You Can Use Prompt Templates
Once a template is active, you can call it from many places:
- Lightning record pages: through Field Generation and the email composer.
- Flow: run a prompt template as an action and use the response in later steps.
- Apex and the REST API: generate responses from code or external apps.
- Agentforce: use a template as an agent action, so agents give consistent, grounded answers.
- External AI tools through MCP: with Headless 360, published Flex templates can be exposed as MCP prompts. A user in an MCP-compatible tool picks the prompt, Salesforce fills in the record data with that user’s own access, and the resolved prompt is ready to send.
The MCP option is new and powerful. Read our full guide: Headless 360 MCP Server Explained.
Prompt Writing Best Practices for Salesforce
- Give the AI a role. “You are a customer success manager” sets the right tone.
- Be specific about format and length. “3 bullet points, under 80 words” beats “short summary.”
- Ground everything. Tell the AI to use only the data provided and not to invent numbers.
- Handle empty data. Add a line like “If no activities exist, say so.”
- Keep one job per template. Small, focused templates are easier to test and reuse.
- Write clear field descriptions. Clean metadata helps both Prompt Builder and AI agents.
- Version your templates. Keep the working version active while you test changes in a new version.
Prompt Builder vs Agentforce: What Is the Difference?
| Prompt Builder | Agentforce | |
|---|---|---|
| What it is | A tool to create reusable prompt templates | A platform for AI agents that reason and take actions |
| Output | Generated content: emails, summaries, field values | Conversations and completed tasks |
| Decision-making | Follows one template | Chooses which actions to run |
| How they work together | Prompt templates are often used inside Agentforce as agent actions | |
In short: Prompt Builder creates the reliable building blocks, and Agentforce decides when to use them. New to agents? Read Salesforce Agentforce vs Einstein.
Costs and Limitations to Know
- Licensing: Prompt Builder requires an eligible Einstein or Agentforce edition or add-on. Some standard templates need specific cloud add-ons.
- Credits: each template run consumes credits, whether it is triggered from the UI, Flow, Apex, an agent or an MCP client.
- Permissions: templates use the running user’s access. If a user cannot see a field, that data will be blank in the prompt.
- AI can still be wrong: keep a human review step for anything customer-facing or high-impact.
Frequently Asked Questions
What is Prompt Builder in Salesforce?
Prompt Builder is a Salesforce tool for creating reusable prompt templates that combine instructions with live Salesforce data. Every prompt is sent to the LLM through the Einstein Trust Layer.
What are the types of prompt templates in Salesforce?
The four main types are Sales Email, Field Generation, Record Summary and Flex. Salesforce also provides standard templates for specific clouds, such as case summaries.
What is a Flex prompt template?
A Flex template is the custom type for any use case not covered by the other types. You define your own inputs, and you can call it from Flow, Apex, the API, Agentforce and MCP clients.
What is grounding in Prompt Builder?
Grounding means adding real data to a prompt, using merge fields, related lists, Flow, Apex or Data 360, so the AI answers from facts in your org.
Do I need to code to use Prompt Builder?
No. You can build and ground templates with clicks using merge fields and flows. Apex is optional and only needed for complex logic.
Is my data safe with Prompt Builder?
Prompts pass through the Einstein Trust Layer, which supports data masking, toxicity detection, audit trails and zero data retention with model providers.
Is Prompt Builder free?
No. It needs an eligible Einstein or Agentforce license, and each template run consumes credits. Check with your Salesforce account team for current pricing.
Key Takeaway
Salesforce Prompt Builder turns AI from a chat window into a reliable part of your business process. Pick the right template type, ground it with real data, test it with real records, and let the Einstein Trust Layer keep it safe. With Headless 360, the same templates now power Agentforce and even external AI tools through MCP.
Want to master Prompt Builder hands-on? Join the SFDC GYM Headless 360 course and build real prompt templates, flows and agent actions step by step.
Sources: Salesforce Help: Prompt Builder, Trailhead: Get to Know Prompt Builder, Salesforce Developers: Prompts from Prompt Builder.
Latest blogs
Salesforce Prompt Builder: Complete Guide to Prompt Templates (2026)
Headless 360 MCP Server Explained: How It Works & How It Powers AIforce