---
schema_version: "1"
id: 562aba850a0a73f772ed1823a86733d984894d4bbc8d40c0c7c92ebe06b13fab
title: Ground with Flow Merge Fields
collection: admin
version: current
locale: en-us
portal_url: https://docs.salesforce.com/admin/current/en-us/ai/264-0-0/prompt_builder_ground_flows.md
canonical_url: https://help.salesforce.com/s/articleView?id=ai.prompt_builder_ground_flows.htm&release=264.0.0&type=5
source_site: help.salesforce.com
content_type: documentation
content_hash: 18a48f33bc11356617fe9f28f50d027778ab2fa30b55f83d5af9114f062fb19c
description: Flows elevate your prompt templates beyond grounding with record fields. Use Flow Builder to add complex logic to a prompt template. With flows, you can also access unified Data 360 objects. By referencing Data 360 data, you can use real-time information that was consolidated across multiple data sources.
products:
  - Agentforce
  - Cross Cloud
release: "264"
---
# Ground with Flow Merge Fields

Flows elevate your prompt templates beyond grounding with record fields. Use Flow Builder to add complex logic to a prompt template. With flows, you can also access unified Data 360 objects. By referencing Data 360 data, you can use real-time information that was consolidated across multiple data sources.

### 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>

If you’re new to flows or Data 360, check out the [Flow Builder Basics](https://trailhead.salesforce.com/content/learn/modules/flow-basics) and [Salesforce Data 360: Quick Look](https://trailhead.salesforce.com/content/learn/modules/salesforce-genie-quick-look/get-to-know-salesforce-genie?trailmix_creator_id=dataclouddocs&trailmix_slug=get-to-know-salesforce-genie) Trailhead modules. To learn about data consolidation with Data 360, see [Salesforce Help: Unify Source Profiles](https://help.salesforce.com/s/articleView?id=data.c360_a_identity_resolution.htm&type=5&language=en_US).

You can create a flow for use with a prompt template by selecting **Template-Triggered Prompt Flow** in Flow Builder. A prompt template flow launches from a prompt template, and then it adds prompt instructions to the associated prompt template. Other flow types aren’t available to prompt templates.

To reference Data 360 data, use the Get Records element. In the Get Records element, select **Data Cloud Object** as your data source. Next, select the relevant data space or object, and specify filters to narrow your data. After that, use Data 360 record data as you do with any record variable in the flow.

Then, use Create Prompt Instructions elements to write the prompt instructions that the flow returns to the associated prompt template. These prompt instructions can include merge fields for CRM and Data 360 data based on the outcome of a Decision element. Each merge field returns a value as a string of text in the prompt instructions. For example, an `Input.Contact.MailingCity` merge field in the Create Prompt Instructions element returns “San Francisco” in the prompt instructions.

You can add a prompt template flow to your prompt template as a merge field with the format `Flow:FlowName`. The flow runs each time a user uses the associated prompt template. Within the flow, each Create Prompt Instructions element adds prompt instructions. When the flow completes, all the prompt instructions are sent to the prompt template and populate the merge field as a string of text.

To use flows in Prompt Builder, see:

- [Add Flow Merge Fields Without Data 360 Objects to a Sales Email Prompt Template](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_add_flows_without_data_cloud_sales_email.htm&release=264.0.0&type=5 "Create and preview an example sales email prompt template that uses a flow.")
- [Add Flow Merge Fields Without Data Cloud Objects to a Field Generation Prompt Template](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_add_flow_without_data_cloud_field_gen.htm&release=264.0.0&type=5 "Create and preview an example field generation prompt template that uses a flow without Data Cloud objects.")

To use flows with Data 360 objects in Prompt Builder, see:

- [Add Flow Merge Fields with Data 360 Objects to a Sales Email Prompt Template](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_add_flows_with_data_cloud_sales_email.htm&release=264.0.0&type=5 "Create and preview an example sales email prompt template that uses a flow with Data 360 objects.")
- [Add Flow Merge Fields with Data 360 Objects to a Field Generation Prompt Template](https://help.salesforce.com/s/articleView?id=ai.prompt_builder_add_flows_with_data_cloud_field_gen.htm&release=264.0.0&type=5 "Build a flow that uses unified Data 360 object data to get a 360-degree view of an account, and then add a flow merge field to your prompt template.")

Because you can now use flows across different template types, including Flex templates, the Flex capability is no longer needed and will be retired in Spring ’25. It’s a good idea to migrate any ​​flows that use the `Flex: *` type. Change the start node type to use manual inputs, then add each of the variables as inputs. Save the flow, then verify that your prompt template continues to work as expected with the flow merge fields.

![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 If you change the inputs for a flow or Apex class that's used as a resource in a prompt template, the prompt template no longer works and you can’t save new versions of the prompt template. See this [known issue](https://issues.salesforce.com/issue/a028c00000ywyBZ/changing-the-shape-of-flowapex-inputs-while-referenced-in-a-prompt-template-leads-to-runtime-failures-and-inability-to-save-new-versions-of-the-temp).