DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Generative AI has transformed nearly every industry. How can you leverage GenAI to improve your productivity and efficiency?

SBOMs are essential to circumventing software supply chain attacks, and they provide visibility into various software components.

Related

  • Automated Bug Fixing: From Templates to AI Agents
  • Build a Serverless App Fast With Zipper: Write TypeScript, Offload Everything Else
  • The Power of Template-Based Document Generation with NLP and AI in Python
  • Building AI Agents Capable of Exploring Contextual Data for Taking Action

Trending

  • Advanced gRPC in Microservices: Hard-Won Insights and Best Practices
  • Modernizing Apache Spark Applications With GenAI: Migrating From Java to Scala
  • Jakarta EE 11 and the Road Ahead With Jakarta EE 12
  • Making AI Faster: A Deep Dive Across Users, Developers, and Businesses
  1. DZone
  2. Data Engineering
  3. AI/ML
  4. How To Build AI-Powered Prompt Templates Using the Salesforce Prompt Builder

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.

By 
Srinivas Sandiri user avatar
Srinivas Sandiri
·
May. 27, 25 · Tutorial
Likes (0)
Comment
Save
Tweet
Share
1.9K Views

Join the DZone community and get the full member experience.

Join For Free

Corporate 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.

An image of Einstein Setup

 

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.

 

An image of prompt template.

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.

 An image of prompt template workspace.


Now, on the Case Lightning record edit page, select the newly created prompt template in the Description field’s properties and save it.

An image of prompt template workspace.


On the Case record page, click on the Einstein Popup window to generate a summary, and insert it in the Description field.

 

An image of Einstein Popup window


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.

An image of a new prompt template.


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.


An image of prompt builder workspace


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. 

An image of output 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.

 An image of a generate case follow up text


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.

 

AI Template

Opinions expressed by DZone contributors are their own.

Related

  • Automated Bug Fixing: From Templates to AI Agents
  • Build a Serverless App Fast With Zipper: Write TypeScript, Offload Everything Else
  • The Power of Template-Based Document Generation with NLP and AI in Python
  • Building AI Agents Capable of Exploring Contextual Data for Taking Action

Partner Resources

×

Comments

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • [email protected]

Let's be friends: