---
schema_version: "1"
id: 3fd02b78fcc2fa83e239476316132988afaa519dd426a33922592e8b84eb9507
title: Create a Reusable Template-Triggered Prompt Flow Example
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/platform/264-0-0/flow_concepts_trigger_prompt_template_capability_reusable_example.md
canonical_url: https://help.salesforce.com/s/articleView?id=platform.flow_concepts_trigger_prompt_template_capability_reusable_example.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: ac1a1c4576030a3bfb1fe2e9911e46f83dd6e12d859e24f449e52b31591abcb0
description: This example creates a sample flow that's available to all prompt templates. Multiple prompt templates can use a single, well-maintained flow for data processing, so this approach saves time, ensures consistency, simplifies development, and improves the reliability of AI-generated outputs.
products:
  - Flow Builder
  - Salesforce Platform
release: "264"
---
# Create a Reusable Template-Triggered Prompt Flow Example

This example creates a sample flow that's available to all prompt templates. Multiple prompt templates can use a single, well-maintained flow for data processing, so this approach saves time, ensures consistency, simplifies development, and improves the reliability of AI-generated outputs.

### 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;"><a href="https://help.salesforce.com/s/articleView?id=platform.flow_ref_supported_editions.htm&amp;release=264.0.0&amp;type=5" title="Learn about the editions and user interfaces that support Flow Builder. Some Flow Builder features integrate with other Salesforce products that require additional licenses.">View supported editions.</a></td></tr><tr class=""><td class="slds-cell-wrap" style="vertical-align:top;">This feature requires the Einstein for Sales, Einstein for Service, or Einstein Platform add-on. To purchase, contact your Salesforce account executive.</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="vertical-align:top;" id="d166762e74">User Permissions
              Needed</th>
          </tr>
        </thead>
        <tbody>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d166762e74 ">To open, edit, create, activate or
              deactivate a flow using all flow types, elements, and features available in Flow
              Builder, including Einstein and Agentforce for Flow:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d166762e74 ">Manage Flow</td>

          </tr>
          <tr class="">
            <td data-label="User Permissions Needed" class="slds-cell-wrap" style="vertical-align:top;" headers="d166762e74 ">To create and manage prompt templates in Prompt Builder:</td>

            <td class="slds-cell-wrap" style="vertical-align:top;" headers="d166762e74 ">Prompt Template Manager permission set</td>

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

Let's say you're a Salesforce admin, and your teams request an easier way to get new cases for an account. You create a prompt template that launches a template-triggered prompt flow to get the case details for the prompt template.

Before creating your prompt template, you create a flow that retrieves the new cases. For this example, you create the Get New Cases for Account flow.

1. Turn on Einstein.
    1. From Setup, in the Quick Find box, enter Einstein Setup, and then click **Einstein Setup**.
    2. Turn on Einstein.
2. Open the Flows list view.
    
    - From the Automation app, select the **Flows** tab.
    - From the **Flows** tab in any Lightning app, click the actions menu and select **Open Flow**.
    - From Setup, in the Quick Find box, enter Flows, and then select **Flows**.
    
    Note that the Automation app and Flows tab options don't require Setup access.
3. Create the flow.
    - From the Automation app, click **New** | **Autolaunched** | **Template-Triggered Prompt Flow**.
    - From Setup, click **New Flow** | **Autolaunched** | **Template-Triggered Prompt Flow**.
4. Configure the flow.
    1. Select **Manual Inputs**.
        
        Each prompt template type is associated with its prompt template type in Prompt Builder.
    2. In Toolbox Manager, click **New Resource**.
        
        ![The Toolbox Manager in Flow Builder](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-platform_automation-264-0-0-production-enus/60568438-ec7e-4665-acd1-7c80dcbe60d5/platform_automation/images/flow/flow_builder_prompt_flow_tool_manager.png)
    3. For Resource Type, select **Variable**.
    4. Set the variable API name and description.
        
        The API name must match the prompte template's API name if the inputs are Text data types or the flow includes more than one input that matches with the prompt template input . For this example, use API name: Account
    5. For Data Type, select **Record**.
    6. For Object, select **Account**.
        
        This data type corresponds to the Account input in a prompt template that references this flow.
    7. Select **Available for input**.
        
        This option lets Prompt Builder set the input.
5. Add the Get Records element and configure it.
    1. For Label, enter Get New Cases.
    2. For Object, select **Case**.
    3. For Condition Requirements, select **All Conditions Are Met (AND)**.
    4. For Field, select **Status**.
    5. For Operator, select **Equals**.
    6. For Value, select **New**.
    7. Click **Add Condition**.
    8. For Field, select **Account ID**.
    9. For Operator, select **Equals**.
    10. For Value, select **Account** then **Account ID**.
    11. For How Many Records to Store, select **All Records**.
        
        ![The Get Records element where two conditions are specified and All records is selected under How Many Records to Store.](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-platform_automation-264-0-0-production-enus/60568438-ec7e-4665-acd1-7c80dcbe60d5/platform_automation/images/flow/flow_builder_prompt_flow_get_records.png)
6. Add the Decision element and configure it.
    1. For Label, enter Any New Cases?
    2. For Select Decision Logic, select **Define Manually (Default)**.
    3. On New Outcome, for Outcome Label, enter Yes.
    4. For Condition Requirements to Execute Outcome, select **All Conditions Are Met (AND)**.
    5. For Resource, select **Cases from Get New Cases**.
    6. For Operator, select **Is Null**.
    7. For Value, select **False**.
        
        ![The Outcome Details in the Decision element](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-platform_automation-264-0-0-production-enus/60568438-ec7e-4665-acd1-7c80dcbe60d5/platform_automation/images/flow/flow_builder_prompt_flow_outcome.png)
    8. Click **Default Outcome**.
    9. For Label, delete the text, and enter No.
7. On the No outcome path, add the Add Prompt Instructions element.
    1. For Label, enter: Add Note About No New Cases.
    2. For Prompt Instructions, enter: No new cases..
        
        ![The Prompt Instructions field that shows New new cases in the Add Prompt Instructions element](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-platform_automation-264-0-0-production-enus/60568438-ec7e-4665-acd1-7c80dcbe60d5/platform_automation/images/flow/flow_builder_prompt_flow_no_new_cases.png)
        
        If the flow takes this outcome path, the flow stores this text in the $Output global variable. When the flow finishes, the flow passes the text to the field generation prompt template.
8. On the Yes outcome path, add the Loop element.
    1. For Label, enter Add Cases.
    2. For Collection Variable, select **Cases from Get New Cases**.
        
        ![The Select Collection Variable section in the Loop element](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-platform_automation-264-0-0-production-enus/60568438-ec7e-4665-acd1-7c80dcbe60d5/platform_automation/images/flow/flow_builder_prompt_flow_coll_var.png)
9. On the For Each path, add the Add Prompt Instructions element.
    1. For Label, enter: Add Case Details.
    2. For Prompt Instructions, enter:
        
        Case Details: {!Add\_Cases.Subject}, {!Add\_Cases.CaseNumber},{!Add\_Cases.Description},{!Add\_Cases.ContactEmail}.
        
        ![The Prompt Instructions field that shows the case details in the Add Prompt Instructions element](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-platform_automation-264-0-0-production-enus/60568438-ec7e-4665-acd1-7c80dcbe60d5/platform_automation/images/flow/flow_builder_prompt_flow_case_details.png)
        
        If the flow takes this outcome path, the merge fields are replaced with Salesforce data such as the subject, description, case number, email for a case. The flow stores the prompt instructions text in the $Output global variable. Each time the flow runs the Add Prompt Instructions element, the text is appended to existing text in the $Output global variable. It can contain details about multiple cases. When the flow finishes, the flow passes the text that's stored in the $Output global variable to the field generation prompt template.
10. Click **Save**.
    1. For Flow Label, enter: Get New Cases for Account.
    2. Click **Save**, and then click **Activate**.

![The Flow Builder canvas that shows the flow](https://sf-zdocs-cdn-prod.zoominsoftware.com/tdta-platform-platform_automation-264-0-0-production-enus/60568438-ec7e-4665-acd1-7c80dcbe60d5/platform_automation/images/flow/flow_builder_prompt_flow_canvas.png)

Now that you completed the flow, you create a prompt template in Prompt Builder that includes an Account input. You add the flow to the prompt template. When you preview the prompt template in Prompt Builder, it triggers the flow to run, and the flow sends its prompt instructions to the prompt template.

#### See Also

- [Add Prompt Instructions Element](https://help.salesforce.com/s/articleView?id=platform.flow_ref_elements_add_prompt.htm&release=264.0.0&type=5 "Provide data in the form of prompt instructions that are merged into a prompt template in Prompt Builder. This element is available only in template-triggered prompt flows.")
- [Global Variables Resource](https://help.salesforce.com/s/articleView?id=platform.flow_ref_resources_global_variables.htm&release=264.0.0&type=5 "System-provided variables store information that can be referenced throughout a flow. For example, it can contain information about the Salesforce org, flow, running user, or triggering record.")
- [Transform Data in a Flow](https://help.salesforce.com/s/articleView?id=platform.flow_build_logic_transform.htm&release=264.0.0&type=5 "Automate how you transform data between Salesforce and an external system using the Transform element. You can create mappings between the source and target data, or set fixed values for the target data.")