Agentforce Prompt Builder Detailed Guide

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.

Salesforce Certified Agentforce ...

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.

A computer screen with several blue and white papers

Description automatically generated

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.

A screenshot of a computer

Description automatically generated

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.

A screenshot of a screen

Description automatically generated

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.

A screenshot of a phone

Description automatically generated

// 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.

A screenshot of a computer

Description automatically generated

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.

A screenshot of a computer

Description automatically generated

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

A white text on a blue background

Description automatically generated

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

A screenshot of a computer

Description automatically generated

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

A screenshot of a computer

Description automatically generated

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

A screenshot of a computer

Description automatically generated

Activate the version

A screenshot of a computer

Description automatically generated

Go to the Experience object and Select the record

A screenshot of a computer

Description automatically generated

Go to Edit Page

A screenshot of a computer

Description automatically generated

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

A screenshot of a computer

Description automatically generated

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

A screenshot of a computer

Description automatically generated

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

A screenshot of a computer

Description automatically generated

Click on the Star icon

A screenshot of a computer

Description automatically generated

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

A screenshot of a computer

Description automatically generated

Worksheet 2 – Create Sales Email Template

Go to Setup. Search Einstein for Sales

A screenshot of a computer

Description automatically generated

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

A screenshot of a computer

Description automatically generated

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.

A screenshot of a computer

Description automatically generated

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.

A screenshot of a computer

Description automatically generated

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.

A screenshot of a computer

Description automatically generated

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.

A screenshot of a computer

Description automatically generated

Go to Setup > Prompt Builder and click New Prompt Template

A screenshot of a computer

Description automatically generated

Select Sales Email in the Prompt Template Type

A screenshot of a computer

Description automatically generated

Add the prompt and Insert the Data

A screenshot of a computer

Description automatically generated

Add the Receipt name to test and preview the prompt

A screenshot of a computer

Description automatically generated

You can see the prompt and the response.

A screenshot of a computer

Description automatically generated

Activate the template

A screenshot of a computer

Description automatically generated

Open the Contact

A screenshot of a computer

Description automatically generated

Select β€˜Draft with Einstein’

A screenshot of a computer

Description automatically generated

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

A screenshot of a computer

Description automatically generated

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).

A screenshot of a computer

Description automatically generated

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.

A screenshot of a computer

Description automatically generated

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

A screenshot of a computer

Description automatically generated

@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.

A screenshot of a computer

Description automatically generated

Go to Setup> Prompt Builder> Click New Prompt Template

A screenshot of a computer

Description automatically generated

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.

A screenshot of a computer

Description automatically generated

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

A screenshot of a computer

Description automatically generated

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.

A screenshot of a computer

Description automatically generated

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?

cartoon doodle font quiz 12244120 ...

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! 🌟

Yay Imessage Sticker - Spongebob ...

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.

 

Did you enjoy this article?
Signup today and receive free updates straight in your inbox.
I agree to have my personal information transfered to MailChimp ( more information )
50% LikesVS
50% Dislikes