---
schema_version: "1"
id: 880bdbf7ff3a9f272b633a3ee41db5ed8331170b82376fd2ab33df5088fed927
title: Add Flow 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_flows_flex.md
canonical_url: https://help.salesforce.com/s/articleView?id=ai.prompt_builder_add_flows_flex.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: d226b2ff6cd5bdcd23fcbec7cc8201eb8c973a8ecbec676686215c89ed7bde84
description: Build a flow that compiles information from multiple sources, and then add a flow merge field to your prompt template.
products:
  - Agentforce
  - Cross Cloud
release: "264"
---
# Add Flow Merge Fields to a Flex Prompt Template

Build a flow that compiles information from multiple sources, and then add a flow merge field to your prompt template.

### 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="d154865e63">User Permissions Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d154865e63 ">To create and manage prompt templates in Prompt Builder:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d154865e63 ">
              <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 create and preview an example flex prompt template. Say you want to generate a newsletter from Product records and Product Service Campaign records. Create a flex prompt template that integrates a flow that obtains record data for an LLM to summarize.

1. In Flow Builder, create a Template-Triggered Prompt Flow to work with your flex template.
    1. Click **New Flow**, and then select the Template-Triggered Prompt Flow card.
    2. Build a flow that gets information on new products and current product service campaigns. See [Build a Flow](https://help.salesforce.com/s/articleView?id=platform.flow_build.htm&type=5&language=en_US).
    3. Save the flow with the label Get Products and Campaign.
    4. Click **Activate**.
        
        ![Note](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-ai-generative_ai-264-0-0-production-enus/f8ef6498-d7b2-44e3-9b34-ffd5a850aae9/images/icon_note.png)
        
        Note Only activated flows appear in the flows list in Prompt Builder. To use a flow in Prompt Builder, its input variables must match the resources defined in the flex prompt template.
2. In Prompt Builder, create a flex prompt template.
    1. Select the **Flex** prompt template type.
    2. Enter Generate a Newsletter for the prompt template name.
    3. Leave the Description field blank.
    4. Define a resource. Select the **Product** object.
    5. Add a second resource. Click **Add**. Select the **Product Service Campaign** object.
    6. Click **Create**.
        
        You're redirected to the Prompt Template Workspace.
3. In the [Example Prompt Template Library](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_example_library.htm&release=264.0.0&type=5 "This library of example prompt templates gives you a starting point for creating your own custom prompt templates."), find the flex prompt template “Generate a Newsletter.” Copy and paste this template into the Prompt Template Workspace.
4. Save your work.
5. In Prompt Builder, edit your Generate a Newsletter prompt template to replace the flow placeholder with the flow you activated.
    1. In the Prompt Template Workspace, delete the {!$Flow:Get\_Products\_and\_Campaigns.Prompt} placeholder.
    2. Click the **Resource** search bar and select **Flows**.
    3. To add this flow to your template, select **Get Products and Campaigns**.
6. Run the prompt template and see the LLM-generated newsletter.
    1. Click the Preview Settings button.
    2. Under Inputs, search for and select a product name in the Product search bar.
    3. Enter a product service campaign name in the Product Service Campaign search bar, and then select it.
    4. 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.
    5. Click **Save & Preview**. Review the response.