How To Build AI-Powered Prompt Templates Using the Salesforce Prompt Builder
We know the power of Generative AI and how to write prompts, but Salesforce also provides a tool to create effective prompts using Prompt Builder.
Join the DZone community and get the full member experience.
Join For FreeCorporate use of Generative AI is currently on an exponential rise, looking to enhance business capabilities and improve agents' efficiency in a variety of cases: writing customer emails, summarizing case conversations, or giving a record snapshot from multiple objects for a quick overview of a customer. Users should write proper instructions to get the optimal output from Generative AI. These instructions are given as prompts, and effective prompts will flow nicely with AI processing. This step-by-step guide will show how efficient Salesforce's Prompt Builder is in creating effective prompt templates by retrieving data and using merge fields referencing record fields and flows. These templates serve to create more personalized output using generative AI.
To create a new template, start by enabling Einstein in your organization. Assign a user with permissions set to “Prompt Template Manager.” This will allow developers to construct and supervise your templates.
Now, navigate through the setup and click on Prompt Builder. Users can develop different types of Prompt Templates based on the license type. It will be available through the “Einstein for Sales,” “Einstein for Platform,” or “Einstein for Service” add-ons. The pre-built templates allow users to choose the best fit for their use case and modify it to create new, reusable prompt templates for personalized automation. Here are a few prompt template types and their purposes:
Extract Product Mentions: This template inspects historical data for customer interactions, emails, and notes to identify and extract product names and product feedback.
Field Generation: This template reduces the need for manual data entry by summarizing data from all open cases and automatically populating the description fields for agents.
Flex: This template can “flex” and adapt to different contexts and inputs, allowing users to define specific use cases that are otherwise ignored by different templates.
Record Summary: This template prepares agents with a quick overview of their customers during calls by gathering key details from records of different objects.
I will now demonstrate Prompt Builder’s effectiveness using two templates as examples: Field Generation and Flex templates.
Field Generation
You will begin by selecting Field Generation in the Prompt Template Type dropdown. Then, fill out the other fields, including the Object and Object Field, to populate the case summary.
Click Next, and the system will take you to the Prompt Builder main screen containing the following elements:
Prompt Template Workspace: Users can enter instructions and merge fields from objects into this space. Merge fields can be inserted using the Resource option.
Preview: When the sample record is selected, this section previews the prompt template. The Resolution shows outputs with record data; the actual output is displayed under Response.
Template Properties: Under the right-hand panel, under template properties, you can select standard and custom models.
In this example, merge fields from the Case Record are provided to generate a summary of the case to populate the Description field. This will give the agent a quick and automated summary and reduce manual entry of the case description. Validate the response and activate it for use at a record level.
Now, on the Case Lightning record edit page, select the newly created prompt template in the Description field’s properties and save it.
On the Case record page, click on the Einstein Popup window to generate a summary, and insert it in the Description field.
Flex Template Creation
Select Flex on the new prompt template type screen and provide the remaining information. This is an example of how service agents can automatically create case follow-up text.
Click Next, and you will land on the Prompt Builder workspace. Case merge fields are provided to create a follow-up text based on the case Type, Reason, and Subject. You can validate the response by selecting the case and clicking the preview button.
Flex templates are customizable and can retrieve data from multiple objects to generate the necessary content for specific scenarios. To invoke a flex template, either use the Prompt as an Invocable Action or a Flow. I will specifically invoke prompts through Flow in this example. Here, I am using a screen flow to pass the record ID to the action element, which invokes the above-created Prompt template for generating the follow-up text. Add a screen element to view the output of the flow response.
Here is the response of the selected case, which generates follow-up text. This can be automated to send as a follow-up on the recently opened Case, improving customer experience. Similarly, other use cases, such as generating a newsletter for guests with promotional events, image verification, and personalized email, are generated.
Conclusion
Prompt Templates in Salesforce improve user efficiency through AI-driven automation. Sales and Service Agents can use these templates in day-to-day activities like record summarization, field generation, and AI-generated emails. The reduced manual effort with accurate, personalized interactions will accelerate decision-making and improve customer engagement. You can be at the forefront of customer interactions by taking full advantage of generative AI and using Salesforce’s Prompt Builder to construct prompts.
Opinions expressed by DZone contributors are their own.
Comments