How to Use Agentforce Prompt Template: Flex Type
April 17, 2025
- Introduction to Prompt Template
- How to Create Flex 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 Flex 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
Translate Text with a Prompt Template and Record-Triggered Flow
- Click on Setup and Search in Quick Find box Prompt Builder
- Click on New Prompt Template
- Choose Prompt Template Type Flex
- Prompt Template Name Translate Survey Input
- API Name will remain as it is
- Template Description Same as Prompt Template Name
- Add these object in the Define Sources
Account
with API name Account
Contact
with API name Contact
Fitness
with API name Fitness
- Click on NextButton
- In the Prompt Template Workspace Write below text:
You are a wellness specialist from a company called Tranquil Trails. Review the content [Survey Input field] . If the content is in a language other than English, translate the text into English, following the instructions below.
Instructions: """
Follow these instructions precisely. Don’t add any information not provided.
- If the content [Survey Input field] is not in English, translate it into English without copying the text in the original language.
- Do not explain what you are doing in this situation—simply translate the text.
- Strictly limit the characters returned to fewer than 255.
Now, evaluate the content.
"""
- Replace the brackets text with the relevant fields using Record input box.
- Click on Save button and Activate the template
- Search in Quick Find Box Flows
- 13. Find existing flow named Translate Fitness Survey Input
- 14. Update the flow to Add a new Action element immediately after the existing Get Records elements called Translate Survey Input
- Write in Label = Translate Survey Input
Set Input Values for the Selected Action
- Account = Account from Account Record
- Contact = Contact from Contact Record
- Fitness = Fitness from Fitness Record
- Add an Update Records element called Update Translated Survey Input that will update the record that started the flow
- Set Field = Translated_Survey_Input__c and Value = {!Translate_Survey_Input.promptResponse}
- Now Save and Activate the flow.
To test the prompt template go to the Latisha Bryce Contact Record
- Scroll down and Find the Fitness related list and Click on New
- In the Survey Input field, enter the Italian phrase Ho sempre desiderato correre una maratona.
- In the Interest Type field, enter Running
- Click on Save button
Output:
After saving the record Translated Survey Input field populates automatically with the English trasnlation of Survey Input Field text.
So this is the example of Flex Prompt Template, I hope this helps you understand the Agentforce Prompt template
Thanks