Agentforce Prompt Builder & Prompt Templates Guide 2026
Prompt Builder —
AI-Powered Templates for Your Agent
Create reusable AI prompt templates grounded in real Salesforce data. Build a Follow-up Email template for XYZ Sales Assistant — and watch AI generate professional emails from actual Account and Opportunity records.
1. What is Prompt Builder?
Reusable AI prompts grounded in real Salesforce data
Write a follow-up email to:
{!$Input:Contact.FirstName} {!$Input:Contact.LastName}
Title: {!$Input:Contact.Title}
Company: {!$Input:Account.Name}
Re: Opportunity: {!$Input:Opportunity.Name}
Stage: {!$Input:Opportunity.StageName}
Amount: {!$Input:Opportunity.Amount}
Keep it professional, warm, and under 150 words.
Dear Priya,
I hope this message finds you well. I wanted to follow up on our discussion regarding the Annual Device Seals contract for MedTech Solutions India.
We're currently in the Negotiation stage and I'm confident we can finalize terms that work well for both teams. The proposed value of ₹18,00,000 reflects our commitment to a long-term partnership.
Would you be available for a brief call this week to move things forward?
Best regards,
XYZ Company Sales Team
After Prompt Builder: Sales rep clicks "Draft Email" in Agent — AI pulls Priya Sharma's details + MedTech opportunity data + writes a professional 150-word email in 3 seconds. Rep reviews, adjusts if needed, sends. 15 minutes → 30 seconds.
2. The 3 Types of Prompt Templates
Each type serves a different use case — know when to use which
| Template Type | Output | Triggered By | XYZ Company Use Case |
|---|---|---|---|
| Field Generation | Single field value | Button click on record page, Agent action | Auto-generate Account Description from industry + size data |
| Record Summary | Multi-paragraph summary | Einstein Copilot, Record page panel, Agent action | Summarize ABC Pharma Account: key contacts, open deals, recent activity |
| Sales Email | Complete email draft | Opportunity email composer, Agent action | Draft follow-up email to Rajesh Mehta re: Silicone Tubing opportunity |
1. Sales Email — Follow-up email for XYZ Sales Assistant agent (main template)
2. Record Summary — Account summary for quick briefings
3. Field Generation — Auto-generate opportunity next steps
The Sales Email template connects directly to the agent as an Action in Module 7.
3. Merge Fields — How Grounding Works
How real Salesforce data gets into your AI prompt
Record Data
Populated
Full Context
Response
With grounding: AI writes "Dear Priya, Following our discussion about MedTech's annual device seals contract (₹18,00,000 — currently in Negotiation stage)..." — specific, professional, instantly useful.
Grounding is what makes AI responses ACCURATE. Without it, AI hallucinates facts.
| Field | Value to Enter |
|---|---|
| Template Name | XYZ Follow-up Email |
| API Name | XYZ_Followup_Email (auto-filled) |
| Description | Generates a professional follow-up email for XYZ Company sales reps based on Opportunity and Contact data |
| Primary Object | Opportunity |
| Related Objects | Contact, Account (add both) |
The merge field picker (usually a button like "Insert Merge Field" or a {!} button) lets you browse and insert fields from related objects without typing them manually.
After pasting the prompt, click Save — then Activate to make it usable.
I hope you're having a great week! I wanted to follow up on our ongoing discussions regarding the Device Seals Annual Contract for MedTech Solutions India.
I'm pleased that we're at the Negotiation/Review stage — it reflects the strong alignment between our teams. The proposed partnership value of ₹18,00,000 underscores our commitment to supporting MedTech's medical device production needs with our premium silicone solutions.
As we're targeting a closure by June 15, 2026, would you be available for a brief call this week to review the final terms and move toward signing?
Looking forward to hearing from you.
Best regards,
XYZ Company Sales Team
| Field | Value |
|---|---|
| Template Name | XYZ Account Summary |
| Primary Object | Account |
| Description | Generates a concise Account briefing for pre-meeting preparation |
RELATIONSHIP STATUS: Existing Customer since 2019. Key customer for XYZ's pharma-grade silicone products...
RECOMMENDED TALKING POINTS: • Discuss renewal of Gasket Supply contract • Explore new silicone tubing requirements for production line upgrade • Introduce new pharma-grade product catalog...
| Field | Value |
|---|---|
| Template Name | XYZ Next Steps Generator |
| Primary Object | Opportunity |
| Target Field | Next Step (Opportunity.NextStep) |
| Description | AI suggests the best next action for an opportunity based on its current stage |
1. XYZ Follow-up Email — Generates professional follow-up emails
2. XYZ Account Summary — Creates meeting briefings
3. XYZ Next Steps Generator — Suggests next actions per opportunity stage
4. Connecting Prompt Templates to Your Agent
How your Sales Assistant uses these templates as Actions
| Prompt Template | Agent Topic | When Agent Uses It | Connected In |
|---|---|---|---|
| XYZ Follow-up Email | Sales Assistant | User asks "draft email to [contact]" or "follow up on [deal]" | Module 7 |
| XYZ Account Summary | Sales Assistant | User asks "brief me on [account]" or "prep for my meeting with [company]" | Module 7 |
| XYZ Next Steps Generator | Sales Assistant | User asks "what should I do next for [opportunity]?" | Module 7 |
Agent thinking: "User wants email draft → call XYZ Follow-up Email Prompt Template → fetch MedTech Opportunity + Priya contact → generate email → return to user"
Agent response: "Here's a draft follow-up email for Priya Sharma at MedTech Solutions: [full professional email]"
Sales rep: copies, reviews, sends. Done in 10 seconds.
5. Prompt Engineering Tips for Salesforce Templates
Write better prompts — get dramatically better AI outputs
| Technique | Example | Why It Works |
|---|---|---|
| Role assignment | "You are a professional sales rep at XYZ Company..." | Sets AI's persona — responses match the role's expertise and tone |
| Explicit format rules | "Write in 4 sections: Overview, Status, Potential, Talking Points" | AI follows structured output — consistent, scannable results every time |
| Word/length limits | "Under 150 words", "ONE sentence", "max 3 bullet points" | Prevents verbose AI responses that overwhelm users |
| Negative instructions | "Do NOT make delivery commitments. Do NOT include pricing not in the data." | Prevents hallucinations and policy-violating content |
| Conditional logic | "If Stage = Qualification, focus on discovery questions. If Negotiation, focus on terms." | AI adapts output based on record state — context-aware responses |
| Output-only instruction | "Write only the email — no explanation or preamble." | Prevents AI from adding meta-commentary like "Here is your email:" |
| Few-shot examples | "Example output: 'Send proposal by Friday and confirm receipt with Priya'" | Shows AI exactly what good output looks like — dramatically improves quality |
6. Troubleshooting Prompt Builder Issues
Common problems and exact fixes
| Problem | Root Cause | Fix |
|---|---|---|
| Merge field shows as blank in output | Field is empty on the test record, OR merge field path is wrong | Check the actual record has data in that field. Verify merge field path: {!$Input:Object.FieldAPIName} |
| "Prompt Builder" not found in Setup | Einstein Generative AI not enabled, or missing permission | Enable Einstein Generative AI → Add "Prompt Template User" Permission Set → Refresh |
| Generated email is too generic | Prompt doesn't have enough specific instructions or merge fields | Add more merge fields (Stage, Amount, Close Date) and add "refer to the specific opportunity details" instruction |
| AI generates wrong format | Format instruction too vague | Give a concrete example in the prompt: "Format as: Subject line / Greeting / Body (2 paragraphs) / CTA / Sign-off" |
| Template activates but doesn't appear in agent | Template not yet connected as Action | This is expected! Connection happens in Module 7. Template is ready — agent connection is next step. |
| Preview shows error "Unable to generate" | LLM token limit exceeded (prompt too long) | Shorten prompt. Remove redundant instructions. Keep total prompt under 2000 characters for best results. |
7. Prompt Builder — Interview Questions & Answers
Common questions in Agentforce developer interviews
| Interview Question | Best Answer |
|---|---|
| What is Prompt Builder in Salesforce? | A no-code tool for creating reusable AI prompt templates grounded in Salesforce record data. Three types: Field Generation (auto-fill fields), Record Summary (summarize records), Sales Email (draft emails). Templates use merge fields to inject real Salesforce data into AI prompts. |
| What is grounding in the context of Agentforce? | Grounding = anchoring AI responses in real, factual Salesforce data. Merge fields pull actual record values into the prompt before sending to LLM. Without grounding, AI generates generic, potentially hallucinated responses. With grounding, responses are accurate and contextual. |
| What are merge fields in Prompt Builder? | Placeholders like {!$Input:Contact.FirstName} that get replaced with real Salesforce field values before the prompt is sent to the AI. They "ground" the AI in actual CRM data — ensuring every generated email uses the real contact's name, real deal amount, real stage. |
| How does a Prompt Template connect to an Agentforce agent? | As a Prompt Template Action in Agent Builder. When agent recognizes the intent (draft email, summarize record), it calls the relevant Prompt Template Action, which fetches record data, populates merge fields, calls LLM, and returns generated output to the user. |
| What is the difference between the 3 Prompt Template types? | Field Generation: AI generates a single field value. Record Summary: AI summarizes an entire record into readable paragraphs. Sales Email: AI drafts a complete email grounded in opportunity/account/contact data. Each type is optimized for its specific output format. |
Module 6 Summary
3 AI templates built — ready to connect to your agent
- ✅Prompt Builder — reusable AI prompt templates grounded in real Salesforce data via merge fields
- ✅3 Template Types — Field Generation, Record Summary, Sales Email — each for different output needs
- ✅Merge Fields — {!$Input:Object.Field} pulls real Salesforce data into prompts before LLM sees them
- ✅Grounding — anchoring AI in factual record data = accurate, personalized responses vs generic hallucinations
- ✅Template 1 — XYZ Follow-up Email: generates professional emails from Opportunity + Contact data
- ✅Template 2 — XYZ Account Summary: creates pre-meeting briefings from Account data
- ✅Template 3 — XYZ Next Steps Generator: suggests next actions based on Opportunity stage
- ✅7 Prompt Engineering Tips — role assignment, format rules, word limits, negative instructions, conditional logic
Starting Module 7, your agent gets REAL DATA superpowers. Standard Actions (M7) connect to Salesforce data out of the box. By Module 9 (Apex Actions), your agent will actually fetch live Opportunities and Accounts and show them in conversations. The agent becomes truly powerful!
🚀 Ready for Module 7?
Next: Standard Actions — Connect your agent to real Salesforce data using pre-built Standard Actions. No code needed! Your agent will finally be able to search records, retrieve account info, and use your Prompt Templates — all in live conversations.
Module 7: Standard Actions →