Execute Flow

Overview

The Execute Flow interaction triggers a background process (an autolaunched Flow) from within a Dynamic Component. This is useful for automating tasks, updating records, performing calculations, or implementing any other logic in a Flow.

Important Note


How it Works

The Execute Flow interaction follows a straightforward process to connect your component with Salesforce automation:

1. Trigger the Flow When a user interacts with your component (such as clicking a button), the Execute Flow interaction launches the specified autolaunched Flow in the background.

2. Send Data to the Flow (Optional) Pass contextual information from your component to the Flow using input variables. This allows the Flow to process specific data, such as record IDs, field values, or user selections.

3. Flow Processes Your Logic The autolaunched Flow executes its configured automation—whether that's creating records, performing calculations, updating data, or any other business logic you've defined.

4. Receive Results from the Flow (Optional) Capture data returned by the Flow through output variables. These results can include newly created record IDs, calculated values, status messages, or any other information the Flow generates.

5. Handle Completion (Optional) Configure what happens after the Flow finishes successfully or encounters an error. Display confirmation messages, refresh data, navigate to a different page, or trigger additional actions to keep users informed and maintain a smooth experience


Configuration

To set up the Execute Flow interaction, you'll need to configure several key settings that control which Flow runs, what data gets passed in and out, and what happens after execution. Let's walk through each configuration option.

Flow API Name

This is the unique identifier that tells the interaction which autolaunched Flow to execute.

  • Format: The API name exactly as defined in Flow Builder (e.g., Create_Case_Records, Calculate_Discount)

  • Where to find it: In Flow Builder, open your Flow and check the Flow properties—you'll see the API Name field when you save or view the Flow details

  • Important requirements:

    • The Flow must be activated before it can be executed

    • Must be an autolaunched Flow (not a Screen Flow or Record-Triggered Flow)

Flow Input Variables

Input variables let you send data from your Dynamic Component into the Flow when it executes. Think of these as parameters you're passing to the Flow—like record IDs, user selections, or field values that the Flow needs to do its work.

How input variables work

  • Each input variable you configure maps to a corresponding variable in your Flow

  • The Flow variables must be marked as "Available for Input" in Flow Builder

  • You can pass multiple input variables to a single Flow execution

Configuring each input variable

Name

The exact API name of the input variable as defined in your Flow.

  • Must match precisely (case-sensitive)

  • Examples: recordId, opportunityStage, accountName

Value

The actual data you want to send to the Flow. You can provide this value in two ways:

  • Static Value Enter a fixed value directly that never changes. Examples: "Active", 100, true, "High Priority"

  • Dynamic Value (click the Map icon) Link the value to a dynamic source from your component. When you click the "Mapped" icon, you can select from:

Value Type
Description

Component Resource

Variables, queries, or formulas defined in your Dynamic Component

Component Attributes

Properties passed into your component

Global Variables

System-wide values like current user or organization info

Selected Row Data

Data from a selected row in a Data Table

Formulas

Calculated values or expressions

💡 Tip: Use the Mapped (x) icon whenever you need the value to be dynamic or come from your component's context. Use static values for constants that never change.


Output Variables

Optional

Output variables capture data that the Flow returns after it finishes running. This allows your Flow to send results back to your Dynamic Component—such as newly created record IDs, calculated values, or status messages—which you can then use to update the UI or trigger additional actions.

How output variables work:

  • Each output variable you configure maps to a corresponding variable in your Flow

  • The Flow variables must be marked as "Available for Output" in Flow Builder

  • The returned data is stored in a Dynamic Component resource that you specify

Configuring each output variable:

Name The exact API name of the output variable as defined in your Flow.

  • Must match precisely (case-sensitive)

  • Examples: outputContentDocumentId, calculatedDiscount, errorMessage

Resource Name The name of the Dynamic Component resource where the Flow's output will be stored.

  • This must be a variable you've already created in your Dynamic Component

  • The data type should match the type returned by the Flow (Text, Number, Boolean, Record, etc.).

Example mappings:

  • Flow outputs a Document ID → Store in: contentDocumentId (Text variable)

  • Flow outputs a discount amount → Store in: finalDiscount (Number variable)

  • Flow outputs success status → Store in: wasSuccessful (Boolean variable)

💡 Tip: Create your Dynamic Component variables before configuring the Execute Flow interaction, so they're available to select in the Resource Name field.


On Finish

The On Finish configuration defines what happens after the Flow completes successfully. This is where you create a responsive user experience by providing feedback, updating the interface, or triggering follow-up actions.


Step-by-Step Example

Bulk Update Contact Status

This example demonstrates how to create a header action button in a Data Table that updates the status of selected Contact records to "Active" using an autolaunched Flow.

Scenario

You have a Data Table in your Dynamic Component displaying Contact records. You want to add a "Set as Active" button in the Data Table's header actions. When users select one or more Contact rows and click this button, the selected Contacts' status should automatically be set to "Active" via an autolaunched Flow.

What you'll build:

  • A Data Table showing Contact records with selectable rows

  • A header action button labeled "Set as Active"

  • An autolaunched Flow that updates the Status field

  • An Execute Flow interaction that triggers when the button is clicked

1

Create the Autolaunched Flow

First, build the Flow that will handle the bulk status update in Salesforce

Flow Setup

  1. In Salesforce Setup, go to FlowsNew Flow

  2. Select Autolaunched Flow (No Trigger) and click Create

Flow Logic

The Flow needs three key components:

  1. Input Variable (Collection):

    • Name: ContactIds

    • Type: Text Collection (must allow multiple values)

    • Critical: This must be configured as a collection to receive multiple Contact IDs from the Data Table when users select multiple rows

    • This is what allows the Flow to process bulk updates rather than just a single record

  2. Update Records Element:

    • Find Contacts where: Id Is In {!ContactIds}

    • Update field: Status__c = "Active"

    • This updates all selected Contact records in bulk

Save and Activate:

  • Save the Flow with a descriptive name (e.g., Set_Contact_Status_Active)

  • Activate the Flow


The key principle: The Flow receives a collection of Contact IDs as input, finds all matching Contact records, and updates their Status field to "Active".

2

Configure Your Data Table in the Dynamic Component

Now that your Flow is created and activated, switch to configuring your Dynamic Component where the Data Table will display Contact records.

Where you are: In the Dynamic Component builder (not in Flow Builder anymore)

Set up your Data Table to display Contacts with row selection enabled:

  1. Select your Data Table component in the Dynamic Component

  2. Configure the data source and columns:

    • Ensure your Data Table is connected to a Query resource that retrieves Contact records

    • Add columns to the Data Table by selecting the fields you want to display (e.g., Name, Status__c, Email)

  3. Enable multiple row selection:

    • In the Data Table properties, locate the Max Row Selection attribute

    • Make sure it's not set to 1 to allow users to select multiple records on the Data Table

    • This ensures users can bulk update multiple Contacts at once.

3

Add the Header Action Button

Add the "Set as Active" button to your Data Table's header:

  1. With your Data Table selected, navigate to the Header section in the properties panel

  2. Click "Add Header Action"

  3. Configure the button:

    • Label: Set as Active

    • Icon (optional): utility:check

    • Type: Button

4

Configure the Execute Flow Interaction

Now connect the header action button to your autolaunched Flow so it triggers when clicked.

Where you are: Still in the Dynamic Component builder, now configuring the interaction

  1. Add the interaction:

    • In the Interactions panel, click "Add Interaction"

    • Interaction Type: Select Header Action Click

    • Target Name: Select the "Set as Active" header action button you created in Step 3

  2. Set the action type:

    • Type: Select Execute Flow

  3. Configure the Flow connection: Flow API Name:

    • Enter: Set_Contact_Status_Active

    • This must match exactly the API name of the autolaunched Flow you created in Step 1

  4. Pass the selected Contact IDs to the Flow: Flow Input Variables:

    • Click "Add Input Variable"

    • Name: ContactIds (must match exactly with your Flow's input variable name)

    • Value: Click the Mapped icon (🔗)

      • Navigate to your Data Table component

      • Select: {!DataTableComponentName.SelectedRowsKeyValue}

    • Important: Toggle on "Allow Multiple values (collection)"

      • This allows passing multiple selected Contact IDs from the Data Table to the Flow as a collection

      • Without this, only one Contact ID would be passed

  5. Configure what happens after the Flow completes: On Finish Actions:

    • Click "Add Item""Refresh All Queries"

    • This automatically reloads the Data Table to display the updated Status values after the Flow finishes.


What you've configured: When users click the "Set as Active" button, the Execute Flow interaction captures all selected Contact IDs from the Data Table, passes them as a collection to your Flow, and refreshes the table once the update is complete

5

Activate and test

Now that everything is configured, it's time to test your work:

  1. Save your Dynamic Component:

    • Click Save in the Dynamic Component builder to save all your changes

  2. Deploy to a Lightning page:

    • Navigate to a Lightning page where you want to use this functionality (e.g., a Contact list page or home page)

    • Edit the page and add your Dynamic Component to it

    • Save and Activate the page

  3. Test the functionality:

    • Go to the Lightning page where you added your component

    • Select one or more Contact rows by clicking the checkboxes

    • Click the "Set as Active" header button

    • Verify that:

      • The selected Contacts' Status updates to "Active"

      • The Data Table refreshes automatically to show the changes

      • You can select and update multiple Contacts at once


Important Considerations


In Summary

The Execute Flow interaction enables you to trigger autolaunched Flows directly from your Dynamic Components, creating powerful automation without requiring users to leave the page.

Key capabilities

  • Automate tasks in the background - Update records, perform calculations, or execute complex business logic when users interact with your component

  • Pass dynamic data to Flows - Send context-specific information like selected record IDs, user inputs, or field values through input variables

  • Handle results intelligently - Capture Flow outputs and use them to update your UI, display messages, or trigger follow-up actions

  • Create seamless experiences - Combine Execute Flow with actions like refreshing data, showing toast notifications, or navigating to different pages to keep users informed

Best practices

  • Always use autolaunched Flows (not Screen Flows) with this interaction

  • Ensure variable names match exactly between your Flow and the Execute Flow configuration

  • Use collections for input variables when working with multiple selected records

  • Configure On Finish and On Error actions to provide clear feedback to users

  • Test thoroughly with both single and multiple record selections

The Execute Flow interaction bridges the gap between user interface and automation, allowing you to build sophisticated, user-friendly applications that leverage the full power of Salesforce Flows

Last updated

Was this helpful?