For the complete documentation index, see llms.txt. This page is also available as Markdown.

How to pass an Input Variable from One Flow to Another

Overview

This step-by-step tutorial will show you how to pass an input variable from one flow to another. This involves creating and configuring variables in both flows and ensuring correct interaction with the Avonni Components Open Flow Dialog.

Scenario: You have a flow that displays a list of Accounts in a data table. When a user clicks a button on an Account row, a flow dialog shows the related Contacts for that Account.


Step 1: Prepare the Target Flow

  1. Go to the Target Flow

    • If you already have a flow you want to use as your target flow, open it in Flow Builder.

    • If you need to create a new flow to serve as the target, create a new screen flow in Flow Builder.

  2. Create a New Variable Element: Add a new variable element to this target flow. This variable will hold the value passed from the first flow.

  3. Choose the Variable Type:

    • Text Variable: Select this if you pass textual information or alphanumeric values.

    • Record Variable: Use this to pass an entire record with its associated field values.

  4. Configure the Variable for Input: Crucially, ensure this variable is available for input. This setting ensures that the variable can receive a value passed from the Open Flow Dialog interaction in the first flow.


Step 2: Configure the Open Flow Dialog in the First Flow

Open the Open Flow Dialog Interaction

In the first flow (the one initiating the process), locate the Avonni Components Open Flow Dialog interaction element. You'll configure this element to open the target flow.

Configure the Input Variable

  • Click "Input Variable": Within the Open Flow Dialog interaction settings, find and click the "Input Variable" button. This will allow you to specify a variable to pass to the target flow.

  • Enter the Variable Name: In the provided field, carefully enter the exact name of the input variable you created in Step 1 in the target flow. Accuracy is crucial here to ensure the correct variable is populated.

  • Select the Value to Pass: Choose the specific value you want to send to the target flow. This could be a literal value (like "Hello"), a formula, or a field reference like a record id.

  • Choose the Value Type: Indicate the data type of the value you pass (Text, Boolean, Date, etc.). This helps ensure compatibility between the flows.


Step 3: Displaying Data in the Target Flow

Configure the Screen Element:

  • In your target flow, you'll likely have a screen element to display information (like a data table, list view, or display text).

  • Configure this element to show the relevant data based on the input variable you received from the first flow.

Example: Filtering a Data Table

  • Let's say you want to display a data table of Contacts related to the Account ID passed from the first flow.

  • Filter the Data:

    • Configure a Query Data Source and filter by the Account ID equal to the input text variable created in step 1.


Passing a Full Record Between Flows

Sometimes you need to pass an entire Salesforce record to the target flow, not just its ID. This saves the target flow from running its own query to get the record data.

  1. Prepare the Target Flow

    • Create a Record Variable (not a Text variable) for the object type you want to receive (e.g., Account, ServiceAppointment).

    • Set the variable as Available for Input.

  2. Configure the Input Variable in the Source Flow

    • In the Open Flow Dialog interaction, add an input variable.

    • Name: The exact API name of the record variable in the target flow.

    • Type: Select Salesforce Object.

    • Object API Name: Enter the object's API name (e.g., Account, ServiceAppointment).

    • Value: Reference the record variable from your source flow. If the value picker forces you to drill into individual fields, click the {a} icon to switch to expression mode and type the reference manually (e.g., {!myAccountRecord}).

  3. Use the Record in the Target Flow

    • The record variable in the target flow now contains the full record, including all the fields queried in the source flow.

    • You can reference its fields directly in screen components, decisions, or assignments — no need for an additional Get Records element.

Tip

The record passed to the target flow contains only the fields that were queried or assigned in the source flow. If the target flow needs fields that weren't included, add them to the original Get Records query or use a separate Get Records in the target flow


Passing an Apex-Defined Variable Between Flows

Flows that use Apex-defined types (custom Apex classes) can pass these types to other flows via the Custom type.

  1. Prepare the Target Flow

    • Create a variable of the Apex-defined type you want to receive.

    • Set the variable as Available for Input.

  2. Configure the Input Variable in the Source Flow

    • In the Open Flow Dialog interaction, add an input variable.

    • Name: The exact API name of the variable in the target flow.

    • Type: Select Custom. A text field appears below the dropdown.

    • In the text field, enter the Apex class name (e.g., MyApexClass or MyNamespace.MyApexClass for managed packages).

    • Value: Reference the Apex-defined variable from your source flow.

  3. Use the Variable in the Target Flow

    • The target flow receives the full Apex-defined object. Reference its properties as you would with any Apex-defined variable in Flow Builder.

Info


Final Thought

Following these steps will enable smooth data transfer between the two flows, ensuring that essential information is accessible and utilized effectively. Remember, correctly configuring variables (respecting the same name) and their accessibility settings is critical to successfully passing values between flows.

Last updated

Was this helpful?