Record Summary Prompt Template in Salesforce Agentforce : Shubham

Record Summary Prompt Template in Salesforce Agentforce
by: Shubham
blow post content copied from  SalesForce FAQs
click here to view original post



### Summary of the Record Summary Prompt Template in Salesforce Agentforce The **Record Summary Prompt Template** is a feature in Salesforce's Agentforce that enables AI agents to generate quick summaries of various records, such as Accounts, Cases, and Opportunities. Instead of users having to navigate through multiple records, they can simply ask the AI agent for a summary, which includes recent interactions, open cases, and deal statuses. This article explains how to create and assign a Record Summary Prompt Template, allowing AI agents to summarize Salesforce records effectively. To create this template, users must navigate to the Prompt Builder in Salesforce's setup menu and fill in specific details, such as the template type (Record Summary), name, and description. After setting up the template, an **Apex class** is required to fetch related data, like cases and orders linked to the account. This class is invoked within the prompt template so that the agent can dynamically gather and display the necessary information. Once the prompt has been created and tested, it can be activated and assigned to an AI agent, enabling it to generate summaries upon request. ### Key Steps to Create a Record Summary Prompt Template: 1. **Navigate to the Prompt Builder**: Go to Setup -> Home Page -> Prompt Builder. 2. **Create New Template**: Click on the "New Prompt Template" button and select "Record Summary." 3. **Fill in Template Details**: Provide a name, description, and select the object type (e.g., Account). 4. **Create an Apex Class**: This class retrieves related data (Cases and Orders) that will be summarized. 5. **Test the Template**: Use the Preview feature to ensure the AI agent generates the correct summary. 6. **Activate and Assign**: Once tested, save and activate the template, then assign it to an AI agent. ### Additional Context The Record Summary Prompt Template streamlines the user experience by allowing fast access to critical information, saving time and enhancing productivity. This feature is particularly beneficial in sales environments where quick decision-making is crucial. ### Relevant Hashtags for SEO #Salesforce #Agentforce #AIPromptTemplate #RecordSummary #SalesforceAutomation #CRM #ApexProgramming #SalesforceTips #ProductivityTools #AIinSales #SalesforceDevelopment #TechTutorials


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.

Prompt Builder and Prompt Templates in Salesforce Agentforce

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.

Agentforce Record Summary Prompt Template

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.

Agentforce prompt Builder to Create Prompt Templates in Salesforce

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.

Invoke Apex Class in Agentforce Prompt Templates

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.

Agentforce Create Record Summary Prompt Template

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.

Record Summary Prompt Template in Salesforce

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.

Create Record Summary Prompt Template in Salesforce Agentforce

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.

Assign Record Summary Prompt Template to AI Agent in Salesforce

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:

The post Record Summary Prompt Template in Salesforce Agentforce appeared first on SalesForce FAQs.


November 10, 2025 at 05:47PM
Click here for more details...

=============================
The original post is available in SalesForce FAQs by Shubham
this post has been published as it is through automation. Automation script brings all the top bloggers post under a single umbrella.
The purpose of this blog, Follow the top Salesforce bloggers and collect all blogs in a single place through automation.
============================

Salesforce