> For the complete documentation index, see [llms.txt](https://docs.avonnicomponents.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.avonnicomponents.com/flow/tutorials/components/data-table/tips-and-tricks/passing-multiple-record-ids-to-another-flow.md).

# Passing multiple record IDs to another flow

Let users tick several rows of the Data Table and send the selected record Ids to a second flow in one click, from a header action.

A sales manager ticks five stale opportunities and clicks **Reassign** in the table header. A second flow opens in a dialog with those five deals and moves them to a new owner. The Data Table sends the selection to that flow as a list of record Ids.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FDUIeSx9ezvLyzw4vuOgI%2Fdata-table-tutorial-passing-multiple-record-ids-to-another-flow-result.png?alt=media" alt="Three opportunities ticked in the Data Table and the Reassign Opportunities flow open in a dialog showing 3 opportunities selected"><figcaption><p>The ticked rows reach the second flow as a list of Ids.</p></figcaption></figure>

## Before you start

* A screen flow with the Avonni [Data Table](/flow/flow-components/data-table.md) showing Opportunities, with the checkbox column visible (**Hide Checkbox Column** off). [Work with Selected Rows](/flow/tutorials/components/data-table/work-with-selected-rows.md) covers selection settings.
* **Key Field** left on `Id` (the default). The selection is sent as the key field values, so another key field sends other values.
* A second screen flow, active, that will do the work. You add its input variable in step 1.

## Steps

{% stepper %}
{% step %}

### Prepare the receiving flow

In the second flow (here **Reassign Opportunities**):

1. Create a variable `opportunityIds`, **Data Type** **Text**, **Allow multiple values (collection)** checked, **Available for input** checked.
2. Add a **Get Records** element on Opportunity with the condition **Id** **In** `{!opportunityIds}`. The flow now holds the selected records and can update them.
3. Save and activate.
   {% endstep %}

{% step %}

### Add a header action

1. In the first flow, select the Data Table and click **Open Component Builder**.
2. In the **Properties** tab, open the **Header** group. Under **Actions**, add an item: **Label** `Reassign`, **Name** `reassign`.

The button appears in the table header.
{% endstep %}

{% step %}

### Open the second flow with the selection

1. Go to the **Interactions** tab and add a **Header Action** interaction.
2. In **Target Name**, pick **Reassign** (the list shows action labels), and set **Type** to **Open Flow Dialog**. Fill **Modal Header** if the dialog should show a title.
3. In **API Name**, pick the receiving flow.
4. Under **Input Variables**, add an item:
   * **Name**: `opportunityIds`, picked from the flow's input variables.
   * **Value**: **Selected Record Ids**, the key field values of the ticked rows (the same values as the table's **Selected Rows Key Field Value** output).
   * **Type**: **Text**, with **Allow Multiple Values (collection)** on.
5. Optional: under **On Finish**, add **Refresh Query** so the table shows the new owners when the dialog closes (Query data source only).

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2Fr7EABFC5eg9b0pH2GqSk%2Fdata-table-tutorial-passing-multiple-record-ids-to-another-flow-interaction.png?alt=media" alt="Header Action interaction passing Selected Record Ids as a text collection to the Reassign Opportunities flow" width="320"><figcaption><p>Selected Record Ids, sent as a Text collection.</p></figcaption></figure>
{% endstep %}

{% step %}

### Save and test

Save and run the flow. Tick three rows and click **Reassign**. The dialog opens on the second flow, and its **Get Records** returns those three opportunities.
{% endstep %}
{% endstepper %}

{% hint style="info" %}
To stop users from clicking **Reassign** with nothing ticked, gray the header actions out until a row is selected: [How to grayscale header actions dynamically](/flow/tutorials/components/data-table/tips-and-tricks/how-to-grayscale-header-actions-dynamically-in-avonni-data-table.md).
{% endhint %}

## Troubleshooting

<details>

<summary>The second flow opens with an empty list</summary>

Check that the receiving variable is a **Text** collection marked **Available for input**, and that the interaction item has **Allow Multiple Values (collection)** on. A single Text variable cannot hold the list.

</details>

<details>

<summary>The flow receives values that are not record Ids</summary>

**Selected Record Ids** sends the values of the table's **Key Field**. Set **Key Field** back to `Id`.

</details>

## Related tutorials

* [How to grayscale header actions dynamically](/flow/tutorials/components/data-table/tips-and-tricks/how-to-grayscale-header-actions-dynamically-in-avonni-data-table.md): disable the button until a row is ticked.
* [Creating Row Actions](/flow/tutorials/components/data-table/creating-row-actions.md): act on one row at a time.
* [Implementing a bulk edit on the Data Table](/flow/tutorials/projects/implementing-a-bulk-edit-on-the-data-table.md): a full project that edits the selected rows.
* [How to create an interaction to open another flow](/flow/tutorials/interactions/how-to-create-an-interaction-to-open-another-flow.md): every Open Flow Dialog setting.


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://docs.avonnicomponents.com/flow/tutorials/components/data-table/tips-and-tricks/passing-multiple-record-ids-to-another-flow.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
