We’re Heading to CNX ’25. Let's Meet in Chicago! Join HIC at Salesforce Connections'25 for conversations, collaboration, and co-creation.

In the world of Salesforce development, prompt templates are like the secret ingredient that powers some of the coolest features in Einstein 1 Studio. They’re the behind-the-scenes magicians who make things happen, from drafting personalized emails to summarizing records and beyond.

But here’s the thing: to make these templates truly shine, you’ve got to ground them with the right data. That’s where Flow and Apex come into play, giving you the tools you need to add context and accuracy to your prompts.

Let’s dive in and see how it’s done!

Understanding Prompt Templates

Picture prompt templates are the building blocks of your Salesforce workflows. They’re the reusable structures that you can mold into whatever you want based on your business requirements.

For instance, a personalized email, a field generation, and many more. When you activate them, they interact with Einstein (the Large Language Model or LLM) to get the responses you’re expecting.

Pretty neat, right?

Types of Prompt Templates

  • Sales Email
  • Field Generation
  • Flex
  • Record Summary
image 5

Data Providers for Grounding

Here’s where the magic happens: grounding your prompt templates with data. Salesforce gives you a few options for this:

Merge Fields and Related Lists
Flow
Apex

These data providers let you tap into your CRM data, Data Cloud info, and even external data sources to strengthen your templates with all the context they need to shine.

image 6

Grounding Prompt Templates with Flow

If you’re not big on code (totally get it!), Flow is your go-to option for grounding prompt templates. You set up this “Template-Triggered Prompt Flow,” plug in your template inputs, and voilà!

Now you can dynamically add text to your templates using the “Add Prompt Instructions” element. It’s like giving your templates a little extra boost.

Firstly, you have to turn on the below checkbox, after only you able to see the Template-Triggered Prompt Flow.

image 7
image 8
image 9

Once the flow is created, you can reference the template inputs as follows.

image 10

Then, once you compute the data to be added to the template, you use a new element called “Add Prompt Instructions” to add text to the template. You can use it as many ways as you need to as it’s additive.

image 11

Finally, in the Prompt Builder templates for which this flow was activated, you’ll be able to see and use the flow.

image 12

Grounding Prompt Templates with Apex

Now, if you’re more of a code wizard, Apex has your back. With an @InvocableMethod and a dash of code magic, you can access your template inputs and do some serious data crunching.

Apex gives you the power to integrate with all sorts of data sources and craft the perfect response for your prompts.

Once your Apex class is deployed to your org, you’ll be able to use it in the Prompt Builder template types for which it was activated through its capability type.

image 13

Which One to Choose: Flow or Apex?

So, which one’s right for you—Flow or Apex? It really comes down to what you’re comfortable with and what your project needs.

Flow is great for quick and easy setups, while Apex gives you more control and flexibility. Whatever you choose, the goal is the same: to make your prompt templates sync with the right data backing them up.

The best way to decide among both of them is based on your business requirements.

Conclusion:

Grounding your prompt templates with data using Flow or Apex is the secret sauce for unlocking the full potential of Einstein 1 Studio. Whether you’re a point-and-click wizard or a code-slinging superhero, there’s a solution for you. 

So go ahead, and add that extra layer of context and accuracy to your templates. Your users will thank you for it!

Stay tuned for more updates and get the latest information!

Related Articles
Expert Guide On Utilizing Agentforce for Seamless Quote & Case Creation

When it comes to managing customer journeys in Salesforce, speed and accuracy matter. That’s where Agentforce, a powerful extension layer, comes into play. Whether spinning up a new quote from an opportunity or logging a support case from a contact, Agentforce can help streamline these actions with minimal clicks and maximum context. In this blog, […]

Read More
How to Use Platform Events in Salesforce Flow for Real Time Updates

Platform events in Salesforce Flow are a great tool for creating real-time, event-driven apps that automate business operations with precision and speed. By integrating Platform Events’ publish-subscribe approach with Salesforce Flow‘s low-code features, you can automate processes, allow real-time system interaction, and optimize how your organization manages dynamic data changes. This guide will demonstrate how […]

Read More
Build a Dynamic Salesforce Data Viewer with hange kardo bas LWC

Lightning Web Components (LWC) is a modern JavaScript framework that is used for building responsive, dynamic applications on the Salesforce platform. In LWC, data flows from parent-to-child component. Variables marked as @api in the child component are open for a parent to pass values directly into the child’s HTML template, making the component interactable. To […]

Read More
Expert Guide On Nominal XIRR Calculation Using LWC in Salesforce

When building financial tools within Salesforce, handling irregular cash flows with precision is a must. Whether you’re developing investment trackers, portfolio performance dashboards, or funding monitors, calculating Nominal XIRR (Extended Internal Rate of Return) becomes essential. In this blog, you’ll learn how to build a Lightning Web Component (LWC) in Salesforce that calculates Nominal XIRR […]

Read More
Beginners Guide to Making Your LWC Component Multilingual

If you’re wondering how to make your LWC component multilingual, you’re already ahead of the curve. Global users expect content in their native language, and Salesforce gives you the tools to deliver exactly that. With Custom Labels and the Translation Workbench, you can easily localize your Lightning Web Components without touching a single line of […]

Read More
Hands-On Guide Building a Drag-and-Drop Form Builder Using Lightning Web Components

Drag-and-drop interfaces are a user experience staple, and when paired with the power of Lightning Web Components (LWC), they unlock dynamic, highly interactive Salesforce components. In this blog post, we’ll walk you through how to build a custom drag-and-drop form builder in LWC. Users can drag form fields like text inputs and dropdowns into a […]

Read More
Our Location worldwide
Indian Flag India
3rd Floor, A-10, Pegasus Tower, Sector 68, Noida, Uttar Pradesh 201301 +91-1203117884
United States of America Flag USA
333 West Brown Deer Road Unit G – 366 Milwaukee WI, USA 53217 +1(262) 310-7818
United Kingdom Flag UK
7 Bell Yard, London, WC2A 2JR +44 20 3239 9428
Canada Canada
HIC Global Solutions INC
6D - 7398 Yonge St #1124 Thornhill, ON L4J 8J2 Canada +1(262) 310-7818