Add Record Merge Fields to a Flex Prompt Template

Save time with templates that use specific information from your Salesforce objects to create unique and detailed product descriptions, custom text messages, and more, at scale. Use merge fields in a flex template to have an LLM write content based on up-to-the-minute data.

Required Editions

Available in: Lightning Experience
Available in: Enterprise, Performance, and Unlimited Editions with the Einstein for Platform, or Einstein or Agentforce for Sales or Service add-on, or Agentforce Foundations
User Permissions Needed
To create and manage prompt templates in Prompt Builder:

Prompt Template Manager permission set

  • Manage Prompt Templates
  • Execute Prompt Templates

OR

Customize Application permission set

Let’s look at a flex prompt template that uses a merge field. Say you work at a company that regularly informs customers about new promotions with text messages. Your customer service team spends a significant amount of time writing these texts from scratch for every promotion. Using an LLM to write these promotions can make this process more efficient and dynamic.

  1. In the Prompt Template Type dropdown, select Flex.
  2. For the Prompt Template Name, enter Ask about a Case.
  3. Leave the Description field blank.
  4. Define a resource. For the Object, select Case. For the Name, enter Customer Case.
  5. Click Next, and you’re redirected to the Prompt Template Workspace.
  6. Write a prompt template from scratch, or copy and paste an example template.
    1. To use an example prompt, copy one of the examples from the Flex Example Templates, and paste it into the Prompt section.
    2. Before you can run this template in Prompt Builder, in the Prompt section, click Insert Resource to replace the placeholders with real merge fields. The search field appears the first time you click this option.
    3. When the template is resolved into a prompt, the merge fields are replaced with real data, shown in the Resolved Prompt section.
  7. Run the prompt template, and see the LLM-generated text message.
    1. Click the Preview Settings button.
    2. Under Inputs, search for and select a case in the Case search bar.
    3. In the Configure Response and Display sections, verify that Generate Response, Display Prompt, and Display Resolution are selected or deselected based on what you want to test.
    4. Click Save & Preview, and review the response.