Building Prompt Templates Without Grounding in Record Data
“An ungrounded prompt hallucinates. A grounded prompt uses your actual Salesforce data.”
What Happened
Built a Prompt Template to generate customer email drafts. Told the AI 'Write a follow-up email to this customer about their recent purchase.' Didn't pass any record data. The AI invented a customer name, a product they didn't buy, and a price that was wrong. The sales rep sent it without reading. The customer replied asking who 'Jennifer' was and why they were being thanked for purchasing a product they'd never heard of.
The Wrong Way
// Prompt Template - no record context Prompt Template: Customer Follow Up Type: Flex Prompt: "Write a professional follow-up email to a customer about their recent purchase. Make it friendly and mention the product they bought." // AI has no data - it makes everything up // Output: "Dear Jennifer, thank you for purchasing our Premium // Widget Package for $2,499..." // Customer's name is Mike. He bought a Basic Plan for $49.
The Right Way
// Prompt Template - grounded in record data
Prompt Template: Customer Follow Up
Type: Flex
Related Object: Opportunity
Prompt: "Write a professional follow-up email to this customer.
Customer Name: {!$Input:Opportunity.Account.Name}
Contact Name: {!$Input:Opportunity.Contact.FirstName} {!$Input:Opportunity.Contact.LastName}
Product Purchased: {!$Input:Opportunity.Product_Name__c}
Purchase Amount: {!$Input:Opportunity.Amount}
Close Date: {!$Input:Opportunity.CloseDate}
Account Industry: {!$Input:Opportunity.Account.Industry}
Rules:
- Use ONLY the data provided above. Do not invent details.
- Keep the tone professional but warm.
- Reference the specific product by name.
- Do not mention pricing unless the customer asks."
// Output uses real data: "Dear Mike, thank you for choosing
// the Basic Plan..."The Lesson
Always ground Prompt Templates in actual record data using merge fields. Tell the AI to use ONLY the provided data. Ungrounded prompts hallucinate confidently.
Enjoyed this? Get more like it.
Glen's Musings — AI, investing, and building things. Occasional. Free.
More AI & Agents Mistakes
Turning On Einstein Prediction Builder with Dirty Data
AI trained on garbage data gives you garbage predictions with confidence scores.
Read moreCareer-EndingDeploying Einstein Copilot Without Testing Its Guardrails
An AI assistant with full org access and no guardrails is a data breach waiting to happen.
Read moreCareer-EndingLetting AI Trigger Actions Without Human-in-the-Loop Approval
AI should suggest. Humans should approve. Not the other way around.
Read more