In the Agentforce prompt builder, we have different types of prompt templates that help define how AI agents perform tasks and respond within Salesforce.
One of these is the Record Summary Prompt Template, which is used to generate a quick and clear summary of any record in Salesforce, such as an Account, Case, or Opportunity.
For example, it can summarize a customer’s recent interactions, open cases, or deal status so that the user does not need to navigate to the particular record; instead, they can directly ask the agent.
In this article, we will learn how to create a record summary prompt template in Salesforce Agentforce and assign it to the AI agent to perform the action.
What is the Record Summary Prompt Template in Salesforce Agentforce?
In the Field Generation Prompt Template, we saw that it automatically generates information and fills it into a Long Text Area field in Salesforce.
This can happen either when a user clicks the Generate button on the record page or automatically when the field generation prompt template is invoked through a Flow.
This feature helps users save time by allowing the AI agent to create or update detailed field content, such as summaries, descriptions, or case notes, based on the record data.
The Sales Email Prompt Template generates email content based on the details we provide, such as customer information or deal stage.
Both the field generation and sales email prompt templates can be invoked directly from a field or a button on the record page.
However, the record summary prompt template works differently. It can only be invoked through an agent action in Salesforce Agentforce.
This means the AI agent uses this template when performing actions such as summarizing a record, not directly from a field or button.
Create Record Summary Prompt Template in Salesforce Agentforce
Below, I will explain how to create a record summary prompt template in Salesforce Agentforce, which helps the AI agent generate summaries of Salesforce records and display them to the user.
Next, we will learn how to assign the created prompt template to different AI agents in Salesforce Agentforce, allowing them to use it while performing their actions.
Let’s take an example to create a record summary prompt template in Salesforce.
Suppose you want to summarize an account record and include related details, such as cases and orders linked to that account. You can achieve this by using the Record Summary Prompt Template, which will display the summarized information directly in the agent action when the AI agent is invoked.
To create the record summary prompt template, navigate to Setup -> Home Page -> and in the Quick Find search, enter ‘Prompt Builder‘. This screen is very similar to our Agentforce Assets, where we create topics and actions.
To create a new prompt, click the New Prompt Template button.

Now, fill in the details for the new prompt template, as I explained below.
- Prompt Template Type: We have different types of prompt templates. We need to select the type of template you want to create here. I have selected the Record Summary.
- Template Name: After that, provide the name of your template as per your requirement. The API Name will be automatically populated.
- Description: Give a short intro about your prompt template.
- Object Type: Here, select the object for which you want to summarize the information. Here I have selected Account.
After that, click the Next button to proceed.

Now, in the Prompt Builder, we have dynamically added the Account field along with some other related Account fields.
With this setup, whenever a user provides an Account Name in the Agent Action, the AI Agent will display the account information based on the instructions defined in the Prompt Template within the Prompt.
The Prompt Builder is used to display information, but it cannot directly retrieve data from Salesforce objects. Since we also need to include related Case and Order details for the Account, we have to create an Apex class that fetches this data.
After creating the Apex class, we can invoke it inside the Prompt Template to display the related information in the Agent Action.

To retrieve information about the Account, we need to create an Apex class. Below, I have created a class that fetches account details along with their related Cases and Orders, which we can use in the Record Summary Prompt Template to display a complete summary in the Agent Action.
public class AccountSummaryPrompt {
@InvocableMethod(label='Soft Drink Orders'
description='Find Soft Drink for Account'
CapabilityType='PromptTemplateType://einstein_gpt__recordSummary')
public static List<Response> getSoftDrinkData(List<Request> requests) {
if (requests.size() != 1)
throw new ListException('The requests list must contain one entry only');
Account acc = requests[0].objectToSummarize;
List<Soft_Drink_Order__c> SoftDrinkOrders =
[SELECT Id,Soft_Drink__r.Name ,Quantity__c from Soft_Drink_Order__c
WHERE Account__c = :acc.Id ];
string responseData = null;
if(SoftDrinkOrders.isEmpty()) {
responseData = 'There are no Soft Drink records.';
} else {
for(Soft_Drink_Order__c drink : SoftDrinkOrders) {
responseData =
(responseData != null) ? responseData + '\n' : '';
responseData += String.format('Soft Drink Details: {0}, {1}.',
new List<Object>{drink.Soft_Drink__r.Name, drink.Quantity__c});
}
}
List<Case> Cases =
[SELECT Id , Reason , Subject ,Description from Case
WHERE AccountId = :acc.Id ];
if(Cases.isEmpty()) {
responseData += 'There are no Cases Records.';
} else {
for(Case ca : Cases) {
responseData =
(responseData != null) ? responseData + '\n' : '';
responseData += String.format('Case Details:- Subject , Reason , Description of the Case are as below: {0}, {1}, {2}.',
new List<Object>{ca.Subject, ca.Reason , ca.Description});
}
}
List<Response> responses = new List<Response>();
Response res = new Response();
res.Prompt = responseData;
responses.add(res);
return responses;
}
public class Request {
@InvocableVariable(required=true)
public Account objectToSummarize;
}
public class Response {
@InvocableVariable
public String Prompt;
}
}After creating the Apex class, we need to invoke it in the prompt template by clicking the Insert Resource option, so that the AI agent can dynamically fetch the related Account, Case, and Order information and display a complete summary in the agent action.

Now, let’s test the template before activating it to make sure the AI agent retrieves and displays the account summary correctly, along with the related case and order details.
To do that, click the Preview button and provide the Record Name. Here, you need to provide the object record name for which you have created this prompt template.
I have provided the account record name to generate the summary. Based on the prompt instructions defined in this template, the AI agent will now display the summarized account details, along with their related cases and orders, in the Agent action.
Next, select the Response Language to display the response, allowing you to view how the AI Agent summarizes the Account information. Then again, click the Preview button to generate the response.

In the image below, you can see that the Related Prompt has been generated, which will be passed to the AI agent. The agent will then process it to develop a clear and concise summary of the account record, along with its related cases and orders.
Then, in the Generated Response, we can see what the AI agent displays in the Agent Action: a summarized view of the account information, along with the related cases and orders, based on the prompt instructions.

If you are getting the correct response, then we are ready to save and activate the Record Summary Prompt Template for use with the AI agent. To do this, click the Save button, provide a label for the template, and then Activate It to use as an agent action.
After activating the Prompt Template, we need to assign it to the AI agent as an agent action so that the agent can use this template to generate record summaries when invoked.

Now, open the AI agent to which you have assigned the record summary prompt template, and provide a prompt to summarize the details by entering the record name.
Then, you will see the AI agent generate and display a summary of that record along with its related cases and orders in the agent action.

In this way, we can create a record summary prompt template in Salesforce Agentforce, which can only be invoked by the AI Agent to generate record summaries automatically.
Conclusion
I hope you have got an idea about how to create a record summary prompt template in Salesforce Agentforce and assign it to the AI agent to perform the action. By using this template, AI agents can quickly generate useful summaries of Salesforce records, such as accounts, cases, or opportunities, helping users get key information.
You may like to read:
- Connect Slack with Salesforce
- Deploy Agentforce Agent from Salesforce to Slack
- Create and Deploy Slack Agent From Salesforce to Slack
- Create an Apex Class & an LWC Component in Salesforce from Agentforce Vibe

Shubham is a Certified Salesforce Developer with technical skills for Building applications using custom objects, approval processes, validation rule salesforce flows, and UI customization. He is proficient in writing Apex classes, triggers, controllers, Apex Batches, and bulk load APIs. I am also familiar with Visualforce Pages and Lighting Web Components. Read more | LinkedIn Profile