---
schema_version: "1"
id: 84dd191104640813d0d0a28c1d9d2511c98714cfd5204494d9dd1fcec7c7f741
title: Add Record Merge Fields to a Flex Prompt Template
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ai/264-0-0/prompt_builder_add_merge_fields_flex.md
canonical_url: https://help.salesforce.com/s/articleView?id=ai.prompt_builder_add_merge_fields_flex.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: bb959b99cf607a7a8ff2c0c795b05e2e4f278d71bbd80fd607a989be3bb7b145
description: 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.
products:
  - Agentforce
  - Cross Cloud
release: "264"
---
# 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

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small edition"><colgroup><col></colgroup><tbody><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: Lightning Experience</td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">Available in: <strong>Enterprise</strong>, <strong>Performance</strong>, and <strong>Unlimited</strong> Editions with the Einstein for Platform, or Einstein or Agentforce for Sales or Service add-on, or Agentforce Foundations</td></tr></tbody></table>

<table class="slds-table slds-table_bordered slds-max-medium-table_stacked slds-m-bottom_small permission">
        <colgroup>
          <col style="width:50%">
          <col style="width:50%">
        </colgroup>
        <thead class="slds-text-title_caps ">
          <tr class="">
            <th scope="colgroup" class="slds-cell-wrap" colspan="2" style="text-align:center;vertical-align:top;" id="d211489e63">User Permissions Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d211489e63 ">To create and manage prompt templates in Prompt Builder:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d211489e63 ">
              <p>Prompt Template Manager permission set</p>
              <ul>
                <li>Manage Prompt Templates</li>

                <li>Execute Prompt Templates</li>

              </ul>
              <p>OR</p>
              <p style="margin-bottom:0;">Customize Application permission set</p>
            </td>

          </tr>
        </tbody>
      </table>

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](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_flex_example_templates.htm&release=264.0.0&type=5 "These example prompt templates cover a few use cases for flex."), 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.