Prompt Builder
Prompt Builder covers 37% of exam. So letβs get the deep understanding on this topic to excel in Agentforce Specialist Certification Exam.

About Me:
Hello, my Name is Smriti Sharan. I am avid blogger and youtuber. Follow my Blog, Linkedin and YouTube to learn various aspect of Salesforce.
feel free to join telegram group.
Follow my Youtube
π° ππ π πππππ ππππππππππ πππππ ππππππππ ππππ-πππππππ, πππππππππ π ππππππππππππs.
Agenda
- What is Prompt
- Good Vs Bad Prompt
- Is it Secure?
- Components of Effective Prompt
- What is Grounding?
- Real Time Business Applications
- Tips for Good Prompting
- Testing Checklist
- Advance Prompting Techniques
- Most Used Prompt Builder Templates
- Hands-On Step by Step Guide (Image attached on every step)
- Worksheet 1 β Create a Field Generation Template
- Worksheet 2 β Create Sales Email Template
- Worksheet 3 β Create Flex Template
- Agentforce Specialist Quiz
Challenge
Meet Sarah, a marketing manager at a growing solar panel company. Every day, she needs to send personalized emails to hundreds of customers. Writing each one takes hours, and by the end of the day, she’s exhausted and the emails start sounding robotic.

One day, Sarah discovers Salesforce’s AI with Prompt Engineering. Now, instead of writing 100 individual emails, she creates ONE smart template that automatically personalizes each message using customer data. What used to take 8 hours now takes 30 minutes.

This is the power of prompt engineering!
What is a Prompt?
A “prompt” is simply the set of instructions you give this assistant.Β It’s more than just a question; it’s a carefully crafted request that guides the AI to give you the exact output you want.

The Power of Templates:Β Salesforce’s Prompt Builder lets you create templates using merge fields (like {!Contact.Name}), Flow Builder for complex logic, and even Apex for advanced scenarios.

// Vague Prompt
Tell me about dogs.
// Specific, Effective Prompt
Write a short, engaging blog post (around 300 words) for new dog owners. The tone should be friendly and reassuring. Cover three essential tips for the first week with a new puppy, such as house training, socialization, and creating a routine.

Statistics Alert:Β Companies using poorly designed prompts see 70% lower engagement rates compared to those using well-engineered prompts. That’s like throwing away 7 out of every 10 potential sales!
Is it secure?
Prompt Builder uses the Einstein Trust Layer to build secure, trusted prompts to avoid sending sensitive information to LLMs. When you generate a response from a prompt built in Prompt Builder, the prompt is sent to the Einstein Trust Layer, which masks any sensitive data before sending it to the LLM. When prompts are sent to external models through the shared trust boundary, your data is encrypted to ensure its security in transit. Additionally, any sensitive information within the prompts is masked.

The Components of an Effective Prompt
Participants
Who’s involved in this interaction?
Example: You are a friendly customer service rep at Ursa Major Solar. Your customers are homeowners interested in clean energy.
Setting
What’s the context and environment?
Example: Our company specializes in residential solar installations. We’re launching a new panel cleaning service.
Goal
What do you want to achieve?
Example: Generate excitement about our new service and get customers to book an appointment.
Relationships
How are people connected?
Example: These are existing customers who trust us and have shown interest in maintenance services.
Data
What specific information to use?
Example: Customer name: {!Contact.Name}, Installation date: {!Account.Install_Date}, Panel count: {!Account.Panel_Count}
Instructions
Exactly what the AI should do
Example: Write a friendly email announcing our panel cleaning service. Include benefits and a call-to-action.
Limits
Boundaries and guardrails
Example: Maximum 300 words. Do not make claims you can’t support. Don’t guess customer preferences.
Language
Which language to use
Example: Write in English, or use {!Contact.PreferredLanguage}
Style & Tone
How should it sound?
Example: Friendly and conversational. Use 8th-grade reading level. Be enthusiastic but professional.
What is Grounding?
Grounding connects your prompts to REAL data in Salesforce.
Without Grounding:
Write a customer email β Generic, useless response
With Grounding:
Write a renewal email for {!Account.Name} using their usage data from {!RelatedTo.Contracts} and highlight their success with {!RelatedTo.Cases} β Personalized, actionable response
Grounding Sources

Common Grounding Mistakes to Avoid
- Insufficient Data:Β Not providing enough context for the AI
- Wrong Object Relationships:Β Using unrelated data sources
- Missing Field-Level Security:Β Forgetting user permissions
- Over-Grounding:Β Including irrelevant data that confuses the AI
Real Time Business Applications

The Challenge:Β How do you show millions of customers products they’ll actually want?
The Prompt Engineering Solution:
Amazon uses sophisticated prompts that analyse:
- Your browsing history
- Past purchases
- Items in your cart
- What similar customers bought
- Current trends in your category
Result:Β That “You may also like…” section drives 35% of Amazon’s total sales β that’s over $160 BILLION in revenue!
Tips for better prompting:
Be Specific, Not Vague
Instead of ‘write about cars’, try ‘write a blog post comparing the fuel efficiency of 2023 Honda Civic and Toyota Corolla’.
Provide Constraints
Guide the AI’s output by setting limits. Use phrases like ‘in 300 words’, ‘in a professional tone’, or ‘avoiding technical jargon’.
Iterate and Refine
Your first prompt is a starting point. If the output isn’t right, tweak your prompt by adding context, clarifying the task, or changing the persona.
Use Strong Action Verbs
Start your task with clear verbs like ‘Generate’, ‘Summarize’, ‘Compare’, ‘Translate’, ‘Classify’, or ‘Rewrite’.
Ask for a Rationale
If you want the AI to reason, ask it to explain its answer. Add ‘Explain your reasoning step-by-step’ to get more detailed outputs.
Few-Shot Prompting
Provide a few examples (shots) of the input/output you want. This is a powerful way to teach the AI the exact format and style you need.

Testing Checklist
Before deploying any prompt template, test with:
- Records with complete data
- Records with missing data
- Records with unusual values
- Different industries/segments
- Edge cases and exceptions
- Various user roles
Security & Compliance Reminder: Always consider data privacy, PII protection, and compliance requirements (GDPR, HIPAA, etc.) when designing prompts. Never include sensitive information that shouldn’t be exposed!
Advance Techniques for Prompting
1. Chain-of-Thought Prompting
Make the AI “think step-by-step” for complex tasks.
2. Do Role-Playing for Better Context
3. Using Flows for Dynamic Logic
Combine Flow Builder with Prompt Builder for conditional content:
4.RAG (Retrieval-Augmented Generation)
Connect your prompts to knowledge bases. Use Case:Β Customer support bot that answers questions
Most used Prompt Builder Templates:

Field Generation
Generates content directly into a specific field on a recordΒ (for example,Β Case.DescriptionΒ orΒ Opportunity.Next_Steps__c).
Sales Email
Draft trulyΒ personalized prospecting/followβup emailsΒ using record and related data. Great for repeatable sales motions.
Flex
Generalβpurpose template forΒ custom outputs.Β Combine record fields,Β FlowΒ results,Β Apex, related lists, even external data via integrations.
Record Summary
Create richΒ summariesΒ for records β also used by Copilot actions for βSummarize this account/opportunityβ.
Hands On Step-by-Step Guide
Trailhead Link to Coral Cloud Resort Project – Sign up to the playground to get Coral Cloud Resort Project for doing Hands On
Worksheet 1 β Create a Field Generation Template
Go to Setup -> Search for Prompt Builder -> Select New Prompt Builder

You will see Prompt Template Workspace

Write the Prompt. Add the Related Record on which you want to test. Do Test and Preview

On preview you will be able to see Prompt and generated response side by side.

Activate the version

Go to the Experience object and Select the record

Go to Edit Page

Enable Dynamic forms and you will see pencil icon besides each field. Select the Review Summary field and on the right side select the prompt template you created earlier

You will see little star besides Review Summary, click on it.

There will be pop on right as Einstein β Review Summary field. Click on Use

Click on the Star icon

You will see review summary field being updated with the prompt.

Worksheet 2 β Create Sales Email Template
Go to Setup. Search Einstein for Sales

Search for Flows -> Add Experience to prompts. It is already made in the βCoral Cloud Resortβ playground.

Flow Type: It’s a Template-Triggered Prompt Flow
This Flow is not meant to be run by a user. It’s an Autolaunched Flow that is only designed to be called as a resource from inside a Sales Email Prompt Template.

This is a Get Records element named “Get Experiences”. Its purpose, get a list of resort experiences that match the guest’s interests.
Object: It is querying and retrieving records from the Experience object.
It is comparing the Type field on the Experience object against three different values. These values are not hard-coded; they are being dynamically pulled from the flow’s input.

After retrieving this list, it will then Loop through each record it found, one by one.
Collection Variable: The loop is set up to iterate over the collection variable named Experiences from Get Experiences. This is the list of records that was found and output by the Get Experiences element in the previous step.

Add Prompt Instruction
This element is an Add Prompt Instructions action. Every time the loop provides an Experience record, this element takes that record’s Name and appends it to a text variable.
Example:
Get Experiences: The flow searches for all Experience records based on customerβs interest provided as input.
- Get Experience where Type = Fitness
- OR Get Experience where Type = Yoga
- OR Get Experience where Type = Relaxation
It finds 3 matching records:
- Record 1: (Name = “Aqua Fitness in Paradise”)
- Record 2: (Name = “Sunrise Yoga on the Beach”)
- Record 3: (Name = “Guided Meditation”)
The flow hands this single, continuous string of text back to the Prompt Template.
Hi Jane,
Based on your interests, I thought you’d love these: Aqua Fitness in Paradise, Sunrise Yoga on the Beach, Guided Meditation.

Go to Setup > Prompt Builder and click New Prompt Template

Select Sales Email in the Prompt Template Type

Add the prompt and Insert the Data

Add the Receipt name to test and preview the prompt

You can see the prompt and the response.

Activate the template

Open the Contact

Select βDraft with Einsteinβ

You will see the draft. You can edit it as needed.

Click send to Send the Email.

Worksheet 3 β Create Flex Template
A Flex template is the most versatile and powerful type of prompt template. It’s used when you have a custom, specialized task that doesn’t fit the standard Field Generation or Sales Email types.
You use it when you want to:
- Call an AI prompt from a custom Flow.
- Call an AI prompt from custom Apex code.
- Build a complex prompt that might use multiple inputs.
Select Personalized Schedule Flow. It will be in the Coral Cloud Resort Playground.

This is a Screen Flow called Personalized Schedule. It’s designed to be run by a user from a button on a Contact record page to instantly generate an AI-powered schedule for that specific person.
Get Contact: The flow’s first action is to get the details of a specific Contact record. It finds this Contact by matching the Contact ID with a variable named recordId. (This recordId variable is automatically filled with the ID of the page the flow is running from).

Invoke Prompt: The flow then takes that Contact record it just found and passes it as an input to an Action called “Generate Personalized Schedule”. This action calls an AI Prompt Template, which uses the Contact’s information to generate a response.

Display Result: Finally, the flow shows the user a screen. This screen displays the output from the previous step.

@InvocableMethod – This makes the getSessions method visible to other tools.
- It is designed to be called by the Generate_Personalized_Schedule prompt template.
- It receives a Contact record as an input.
- It uses that Contact to find a list of related Session__c records (by calling another class, ExperienceSessionController).
- It converts that list of sessions into a single JSON text string.
- It then returns this JSON string to the prompt template so the AI can read and use that data.

Go to Setup> Prompt Builder> Click New Prompt Template

Select Flex Template. The Inputs section is how you pass data into the prompt template.
Name: contact
Source Type: Object
Object: Contact
This configuration tells the prompt template, to run, you must be given a Contact record.
This allows you to write a prompt (in the next step) that uses data from that specific contact, like this:
Generate a schedule for {!contact.FirstName} based on their registered interests: {!contact.Interests__c}.
Without this Input defined, the prompt would have no way to know which guest it’s supposed to be personalizing the schedule for.

Add the Prompt and check the output. Test it with a contact.

Go to contact. You will see the button named as βPersonalized Scheduleβ. Click on it so as to invoke the flow and see the schedule.

Grounding: Feed the LLM trusted Data (safely)
Record & Related Lists
Merge fields from the current record and first 5 columns of selected related lists (respecting fieldβlevel security & layout visibility).
Flow/Apex results
Run business logic first (aggregations, filtering, long text assembly), then pass compact context to the prompt.
RAG & external docs
Retrieve unstructured content (FAQs, contracts) and include short, cited snippets to guide the response.
Who can build & who can run?
Permissions
Prompt Template Manager: create/manage templates.
Prompt Template User: execute templates (outside builder), e.g. buttons & Copilot.
Ready for the Quiz?

Q1. Which Prompt Builder type is best to populate Case.Description with an AI-written wrapβup?
A. Flex
B. Field Generation
C. Record Summary
Correct.Β Field Generation targets a single destination field on the record.
Q2. You need a reusable prospecting email that pulls Account size, last meeting notes, and top product. Which template?
A. Sales Email
B. Record Summary
C. Flex
Correct.Β Sales Email is purpose-built for personalized outbound with CRM data.
Q3. Grounding with related lists fails. What is a likely cause?
A. The related list isnβt on the page layout
B. Too many columns on the list
C. The record has no owner
Correct.Β Prompt Builder only exposes related lists present on the page layout (and respects permissions).
Q4. Which Trust Layer controlΒ preventsΒ prompts from leaking PII to the LLM?
A. Prompt Defense
B. Zero Data Retention
C. Data Masking
Correct.Β Masking happens before the LLM. zero-retention governs training/retention at the LLM.
Q5. Goal: βList top 3 churn risks in a summary.β Best approach?
A. Ask the LLM to infer risks
B. Ground with Flow that ranks risks, pass top 3
C. Use Account.Name as only context
Correct.Β Compute business logic in Flow; let the LLM format and explain.
Q6. You want a oneβclick βSummarize this Opportunityβ inside Copilot. Which template powers this?
A. Record Summary
B. Sales Email
C. Field Generation
Correct.Β Copilot summary actions typically use Record Summary prompt templates.
Q7. A security team asks if the external LLM will train on your prompts. Correct answer?
A. Yes, for quality
B. No β Zero Data Retention applies
C. Only if you opt in via a checkbox
Correct.Β Salesforceβs Trust Layer enforces a zeroβretention policy with supported LLMs.
Q8. Users canβt create templates. What permission set are they missing?
A. Prompt Template User
B. Prompt Template Manager
C. Einstein Admin
Correct.Β Managers create/manage; Users execute templates outside the builder.
Q9. Which tuning increases creativity/variance of LLM outputs?
A. Lower temperature
B. Higher temperature
C. Higher frequency penalty
Correct.Β Raising temperature increases randomness/creativity.
Q10. Which isΒ notΒ a good grounding source?
A. Flow outputs
B. Random public web page
C. Related lists
Correct.Β Stick to trusted sources (CRM, Flow, vetted docs). Untrusted web pages break accuracy & governance.
Q11.Β You include Opportunities related list on Account layout and ground a Record Summary. What columns are sent?
All columns in the related list
The first 5 visible columns
Columns with numeric data only
Correct β Grounding uses the first five visible columns, respecting permissions.
Q12.Β Temperature = 0.8 generally yields
More creative/varied text
Deterministic repeatable text
Truncated output
Correct β Higher temperature increases variation.
Q13.Β Activities related list on Account for grounding?
Supported only for last 30 days
Not supported
Always supported if admin
Correct β Activities on Account/Contact arenβt supported for RL grounding.
Q14.Β Which combo best defines a highβquality prompt?
Long text walls
Role + Task + Context + Constraints + Output
Short, funny haiku
Correct β Structure beats length.
Q15.Β A team wants consistent, short answers. What control helps?
Lower temperature
Higher temperature
Presence penalty only
Correct β Lower temperature pushes consistency.
πYou’ve Completed the Prompt Builder Journey! π

If you like the work, subscribe to sfdcamplified.
About Me:
Hello, my Name is Smriti Sharan. I am avid blogger and youtuber. Follow my Blog, Linkedin and YouTube to learn various aspect of Salesforce.
feel free to join telegram group.
Follow my Youtube
π° ππ π πππππ ππππππππππ πππππ ππππππππ ππππ-πππππππ, πππππππππ π ππππππππππππs.
Author Note
It takes a lot of time to build and document this stuff. Feel free to provide feedback so I can make better Hands-on Project and Documentations in future.