How to Use Agentforce Prompt Template: Field Generation Type
April 17, 2025
After completing this unit, you will able to:
- Introduction to Prompt Template.
- How to Create Field Generation Prompt Template.
Introduction
In this blog, We will explore about the Agentforce Prompt template use cases and how to use prompt tempates to make tasks easy. let's get started.
🔍 What is a Prompt Template in Salesforce?
A Prompt Template in Salesforce is a reusable AI instruction pattern that tells the generative AI (like Einstein GPT or Agentforce) what to do, what data to use, and how to respond.
It acts as a blueprint that:
- Standardizes how AI gets instructions.
- Injects Salesforce record data automatically into those instructions.
- Controls and governs AI outputs in a consistent, secure, and scalable way.
🧠 Why Are Prompt Templates Important?
With Salesforce integrating more deeply with generative AI tools, you don’t want every user or developer writing their own prompts from scratch. Templates help by:
- Ensuring consistent tone and output.
- Using secure, predefined data inputs.
- Saving time through reusability.
- Empowering teams to deploy AI use cases without deep AI prompt engineering skills.
🔄 Types of Prompt Templates
- Flex - Content for any business purposes that other templates don’t cover. Flex prompt templates let you define your own resources.
- Field Generation - Content for record fields in Lightning Experience. In Salesforce, users click a button to run this prompt and populate the field with output.
- Sales Emails - Personalized customer email based on record data.
Create a Developer Edition Org with Special Configuration:
https://trailhead.salesforce.com/promo/orgs/earn-the-prompt-builder-templates-superbadge-unit
How to Create Field Generation Prompt Template
Before creating template we need to enable some configuration to make it available prompt template in salesforce org.
- Click on Setup and Search in Quick Find box Einstein Setup
- Click on Einstein Setup
- Turn on the Turn on Einstein radio button
- Refresh the browser tab
Build an AI-Generated Summary of Related Records
- Create a custom field on Contact called Interest Summary (with the API name Interest_Summary__c)
- Click on Setup and Search in Quick Find box Prompt Builder
- Click on New Prompt Template
- Choose Prompt Template Type Field Generation
- Prompt Template Name Summarize Client Goals
- API Name will remain as it is
- Template Description Same as Prompt Template Name
- Select Object as Contact and object field as Interest Summary
- Click on Next Button
- In the Prompt Template Workspace Write below text:
You are a wellness coach from a company called Tranquil Trails who wants to see a quick summary of a client's fitness interests.
Review the content in the list of fitness records related to a contact record, [Related list of all Fitness records]
In this list all records relate to the individual contact.
Fitness records: [Related list of all Fitness records]
Contact name: [Input the contact's first name]Instructions: """
Follow these instructions precisely. Don’t add any information not provided.
The "contact" must be referred to as a "client" in the summary.
Use clear, concise, and straightforward language in the active voice and a friendly, informal, informative tone.
The summary must include the following:
Use the client's first name in the first sentence.
Interpret any reported stress level based on a scale from 1-10, with values of 7-10 being ideal.
If any values are missing, do not include any reference to missing information.
Do not address any content or generate answers that don’t have complete data.
Do not use filler words or phrases or redundant language.
Use an introductory summary sentence and closing sentence in addition to several bullet points.
When you format the list, use a variety of emoji as bullet points to add interest.
Limit the summary to seven sentences.
"""
- Replace the brackets text with the relevant fields using Record input box.
- Select Model: OpenAI GPT 4 Turbo
- Click on Save button and Activate the template
- Search Contact record Robinette Bullman
- Edit the page by clicking on gear button
- Click on Fields and in right side Click on Upgrade Now button
- Scroll down and select Interest Summary Field
- In the right side Prompt Template box Select your Prompt template. (If you are not able to see the template name in the Prompt Template box make sure you have activate the Prompt Template.)
- Click on Save button and Activate
- Click on the back arrow
- Edit the Interest Summary field and click on Icon next to field.
- Eienstein Generative AI Generate the related records summary and click on Use button
Output:
This is an example of a Field Generation Prompt Template — I hope it helps you better understand how Agentforce Prompt Templates work.
Thanks