# How to Pass Multiple Selected Records from a Dynamic Component to a Screen Flow

## Overview

Learn to send a collection of records (e.g., rows selected in a Data Table) from your Avonni Dynamic Component into a Screen Flow launched via "Open Flow Dialog" or "Open Flow Panel." This guide covers setting up the Flow's input collection variable and mapping the selection in the interaction

***

## Prerequies&#x20;

{% hint style="danger" %}

## **Important Prerequisite: Configure Flow Input Collection Variable**

Before proceeding, ensure the Screen Flow you intend to launch has a **Collection Variable** configured to receive the selected records. In the Flow Builder, this variable *must* have "**Allow multiple values (collection)**" and "**Available for Input**" checked. (A `Text` data type is commonly used for passing record IDs). This setup is required so you can map the selected records to this variable in the interaction settings
{% endhint %}

***

## Guided Steps: Passing Selected Records to a Flow

{% stepper %}
{% step %}

### Prepare Your Data Display Component

* **Ensure Multi-Select is Enabled:** Select the component where users will choose multiple records (e.g., your Avonni **Data Table**). In its Properties Panel, ensure the setting allowing **multiple row selection** is enabled.
* **Note the API Name:** Confirm the **API Name** of this Data Table (e.g., `OpportunityTable`), as you'll need it in Step 4
  {% endstep %}

{% step %}

### Create the Trigger Action Element

* Add the component users will click to start the process. This is usually an **Avonni Button** placed near your data component, or a **Header Action** configured directly within the Data Table's header properties.
* Give this button/action a clear **Label** (e.g., "Process Selected Opportunities", "Update Statuses")

<figure><img src="https://2532358799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODPvvv7Cx9Z9RECLn3oV%2Fuploads%2FlYfoG0iXgrpAt8tJm5kU%2F2025-04-16_13-50-26.png?alt=media&#x26;token=b760e7c4-11d8-4ebf-bfd8-f8b4b9a3a3cc" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Add the "Open Flow Dialog/Panel" Interaction

* Select the Button or Header Action you created in Step 2.
* In the Properties Panel, go to the **Interactions** section.
* Choose the event to trigger the Flow (typically **On Click**).
* Click **Add Action**.
* Set the **Action Type** to either **`Open Flow Dialog`** or **`Open Flow Panel`**.
* In the **Flow API Name** setting, select the specific **Screen Flow** you prepared earlier (the one containing the input collection variable – see Prerequisite section).

<figure><img src="https://2532358799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODPvvv7Cx9Z9RECLn3oV%2Fuploads%2F26PpOXgUn9oFSt3SByh8%2F2025-04-16_13-53-48.png?alt=media&#x26;token=01cbf18e-5988-4a15-a773-d66376bdbbfe" alt=""><figcaption></figcaption></figure>
{% endstep %}

{% step %}

### Map Selected Records to the Flow's Input Variable

This is crucial in connecting the Data Table's selection to the Flow. Within the configuration settings for the **"Open Flow Dialog/Panel"** action you just added:

1. Find the **Input Variables** section.
2. Click the "Add Item" button to create a mapping.
3. **Input Name:** From the dropdown list, select the **API Name** of the **Collection Variable** you created inside your Screen Flow (marked as 'Available for Input' in the prerequisite step).
4. **Value:** Click the **resource selector icon** next to the value field.
   * Choose **Component Attribute**.
   * Select your **Data Table** component (using its API Name, e.g., `OpportunityTable`).
   * Choose the attribute that holds the selected row data:
     * **`selectedRowsKeyValue`**: Use this if your Flow's input collection variable is of type `Text` and you want to pass **only the record IDs**. This is the most frequent use case.
       {% endstep %}
       {% endstepper %}

<figure><img src="https://2532358799-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2FODPvvv7Cx9Z9RECLn3oV%2Fuploads%2F6MTnmmNSb6dfYZhmwiD4%2F2025-04-16_14-42-45%20(1).gif?alt=media&#x26;token=0bfd65d4-afe6-40ae-9d97-42608a169c8c" alt=""><figcaption></figcaption></figure>

***

## **Troubleshooting Common Issues**

* **Flow Doesn’t Launch:** Verify the **Flow API Name** matches an existing Screen Flow with the input collection variable configured. Check user permissions to access the Flow.
* **No Records Passed:** Ensure multi-select is enabled on the Data Table and rows are selected before triggering the action. Confirm the selectedRowsKeyValue attribute is mapped correctly.
* **Error on Mapping:** Ensure the Flow’s input Collection Variable API Name matches the **Input Name** in the interaction. Mismatched names or types (e.g., Text vs. Record) cause errors.
* **Outdated Package Version:** If the interaction fails, you might be using an obsolete version of the Avonni Components package. [**Update to the latest version**](https://docs.avonnicomponents.com/dynamic-components/tutorials/interactions/flow-integration/broken-reference) to ensure compatibility with this feature.
* **Performance Lag:** Large record selections may slow the Flow. Limit the Data Table’s row count or use filters to reduce data volume.
* **Other Issues:** If you encounter persistent problems, please reach out to us at [**support\_dc@avonni.app**](mailto:support_dc@avonni.app)
