> 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/tips-and-tricks/how-to-pass-your-current-recordid-in-your-screen-flow.md).

# How to pass your current RecordID in your screen flow

## Overview

Salesforce hands the record Id to your flow through an input variable named `recordId`. You create that variable once, then pick how the user reaches the flow:

Prefer to watch? Browse the [video tutorials](https://docs.avonnicomponents.com/videos), or see every [Flow Screen Component](https://docs.avonnicomponents.com/flow/flow-components/explore-all-flow-screen-components).

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2Fwr2hPMJQCF1OWmkja4gK%2Frecordid-how-to-pass-your-current-recordid-in-your-screen-flow-result.png?alt=media" alt="A screen flow running on the Salesforce Account record page of Bluewater Logistics: it receives the recordId and lists the Account&#x27;s three open Cases in an Avonni Data Table"><figcaption><p>The flow knows which Account it is on: the table shows only its open Cases.</p></figcaption></figure>

| The user...                                       | Use                                                                                                                           | Salesforce fills `recordId` when                                         |
| ------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------ |
| Sees the flow inside the page, next to the record | The **Flow** component on the **Record Page** ([Setting Up Your Flow and App Builder](#setting-up-your-flow-and-app-builder)) | You check **Pass record ID into this variable** in Lightning App Builder |
| Clicks a button that opens the flow in a window   | A **Quick Action** ([Configuring a Quick Action](#configuring-a-quick-action-to-pass-the-record-id-to-a-flow))                | Always, if the variable is named exactly `recordId`                      |

Once the flow has the Id, it can load the record with a Get Records element, and the Avonni components on its screens can filter on it.

{% hint style="info" %}

#### Salesforce Flow Screen Components guide

New to building Screen Flows? Our [Salesforce Flow Screen Components guide (2026)](https://www.avonni.app/blog-posts/salesforce-flow-screen-components-guide-2026) covers the screen components you can use once your flow knows which record it is working on.
{% endhint %}

***

## Setting Up Your Flow and App Builder

Use this when the flow lives on the page itself, for example a panel of the Account's open Cases that the agent works through without leaving the record.

### Step 1: Create a `recordId` Variable in Your Flow

{% stepper %}
{% step %}

#### Open your screen flow

In **Setup**, search for **Flows** and open the screen flow, or click **New Flow** and choose **Screen Flow**.
{% endstep %}

{% step %}

#### Create the variable

In the **Toolbox**, click **New Resource** and fill in:

* **Resource Type**: Variable
* **API Name**: `recordId`
* **Data Type**: Text
* **Available for input**: checked

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FKVI10eYReqZaDNwnkdJu%2Frecordid-how-to-pass-your-current-recordid-in-your-screen-flow-new-resource.png?alt=media" alt="Flow Builder New Resource dialog creating a Text variable named recordId with Available for input checked, for a screen flow" width="375"><figcaption><p>The recordId variable: Text, Available for input.</p></figcaption></figure>

Type `recordId` exactly: a lowercase `r` and a capital `I`. A Quick Action only fills a variable with that exact name, and keeping the same name everywhere means one flow works from both launch points.
{% endstep %}

{% step %}

#### Save and activate the flow

Click **Done**, then **Save** and **Activate**. Lightning App Builder only lists active screen flows.
{% endstep %}
{% endstepper %}

### Step 2: Add the Flow to Your Record Page and Pass the Record ID

{% stepper %}
{% step %}

#### Open the Record Page in Lightning App Builder

Open any record of the object (an Account, for example), click the **Setup** gear and choose **Edit Page**. You can also go through **Setup**, **Lightning App Builder**, and **Edit** on the page.
{% endstep %}

{% step %}

#### Add the Flow component

Drag the standard **Flow** component onto the page, then choose your flow in the **Flow** field of its properties panel.
{% endstep %}

{% step %}

#### Check Pass record ID into this variable

The properties panel lists every input variable of the flow. Next to `recordId`, check **Pass record ID into this variable**. This is the setting that sends the page's record Id into the flow.

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FgNBiNG0Vj17PyJ6jsTUI%2Frecordid-how-to-pass-your-current-recordid-in-your-screen-flow-app-builder-checkbox.png?alt=media" alt="Lightning App Builder Flow component properties: the screen flow Open Cases selected, and Pass record ID into this variable checked for the recordId input variable" width="375"><figcaption><p>The checkbox that sends the page's record Id into recordId.</p></figcaption></figure>
{% endstep %}

{% step %}

#### Save and activate the page

Click **Save**. If the page is not assigned yet, click **Activation** and assign it as the org default, or to the apps and profiles that should see it.
{% endstep %}
{% endstepper %}

***

## Configuring a Quick Action to Pass the Record ID to a Flow

Use this when the flow should start on demand, from a button such as **Log a Visit** on the Account. A Flow-type Quick Action fills `recordId` by itself: there is nothing to map.

### Step 1: Create a `recordId` Variable in Your Flow (if you don't have it already)

Create the variable as in [Step 1 above](#step-1-create-a-recordid-variable-in-your-flow). For a Quick Action the name is a requirement: a Text variable named exactly `recordId`, with **Available for input** checked. Then save and activate the flow.

### Step 2: Create and Configure the Quick Action

{% stepper %}
{% step %}

#### Open the object's actions

In **Setup**, open **Object Manager**, select the object (Account, Contact, Case...) and click **Buttons, Links, and Actions**, then **New Action**.
{% endstep %}

{% step %}

#### Fill in the action

* **Action Type**: Flow
* **Flow**: your screen flow, listed by its label (only active screen flows are listed)
* **Label**: what users see on the button, for example `Log a Visit`
* **Name**: filled in from the label

<figure><img src="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FhIbKvEIqQnvf0LQAMQJM%2Frecordid-how-to-pass-your-current-recordid-in-your-screen-flow-quick-action-form.png?alt=media" alt="Salesforce New Action form on Account: Action Type Flow, Flow Open Cases, Label Log a Visit. There is no field to map the recordId of the screen flow" width="375"><figcaption><p>A Flow Quick Action: no field to map, Salesforce fills recordId.</p></figcaption></figure>

You will not find a field for the record Id here, and you do not need one. When a user clicks the action on a record, Salesforce puts that record's Id in the flow's `recordId` variable.
{% endstep %}

{% step %}

#### Save the action

Click **Save**.
{% endstep %}
{% endstepper %}

### Step 3: Add the Quick Action to the Page Layout

{% stepper %}
{% step %}

#### Open the page layout

In **Object Manager**, on the same object, click **Page Layouts** and open the layout your users have.
{% endstep %}

{% step %}

#### Add the action

In the palette, click **Mobile & Lightning Actions**, find your action by its label and drag it into the **Salesforce Mobile and Lightning Experience Actions** section. If that section shows Salesforce's predefined actions, click the link to override them first.
{% endstep %}

{% step %}

#### Save and check the record page

Click **Save** and open a record. If the button does not show, the page probably uses Dynamic Actions: open it in Lightning App Builder, select the **Highlights Panel** and add the action there instead.
{% endstep %}
{% endstepper %}

***

## Use the recordId in your flow

The variable holds an Id, not the record. To read the record's fields, add a **Get Records** element at the start of the flow:

1. **Object**: the object of the page, for example Account.
2. **Filter**: `Id` Equals `{!recordId}`.
3. **How Many Records to Store**: Only the first record.

Every later element can now use the record's fields, such as `{!Get_Account.Name}`. To fetch related records instead, filter on the lookup field: Contacts where `AccountId` Equals `{!recordId}`.

On an Avonni screen you often skip the Get Records: a Data Table or Map with a **Query** data source can filter on `{!recordId}` directly. See [Filter a Data Table or Map by the current record](https://docs.avonnicomponents.com/flow/tutorials/tips-and-tricks/filter-a-data-table-or-map-by-the-current-record.md).

***

## Problems

<details>

<summary>I don't see the Pass record ID into this variable checkbox</summary>

The checkbox only appears for a Text variable with **Available for input** checked. Check the variable in Flow Builder, save and activate the flow, then select the Flow component again in Lightning App Builder so it reloads the variables.

</details>

<details>

<summary>My flow is not in the list (Lightning App Builder or New Action)</summary>

Both lists show active screen flows only. Activate the flow. An autolaunched or record-triggered flow never appears there.

</details>

<details>

<summary>recordId is empty when the flow runs</summary>

Three usual causes:

* The checkbox is not checked on the Flow component, or the page you edited is not the one assigned to the user (check **Activation**).
* For a Quick Action, the variable name does not match `recordId` exactly (case counts), or the variable is not Text.
* The flow was started from Flow Builder or from the Flows list, where there is no record. See [Test a screen flow that needs a record Id](https://docs.avonnicomponents.com/flow/tutorials/tips-and-tricks/test-a-screen-flow-that-needs-a-record-id.md).

</details>

<details>

<summary>The Quick Action button does not appear on the record</summary>

The page uses Dynamic Actions, so the page layout's action section is ignored. Add the action to the **Highlights Panel** in Lightning App Builder.

</details>

***

## Go further with recordId

Once the flow receives the record Id, these pages show what to do with it.

<table data-view="cards"><thead><tr><th></th><th></th><th data-hidden data-card-cover data-type="files"></th><th data-hidden data-card-target data-type="content-ref"></th></tr></thead><tbody><tr><td><strong>Filter a Data Table or Map by the current record</strong></td><td>Show only the Account's open Cases or Contacts on a flow screen, with recordId in the query filter.</td><td><a href="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FoSb8luXRbb157dDEyngh%2Frecordid-cover-filter-a-data-table-or-map-by-the-current-record.png?alt=media">recordid-cover-filter-a-data-table-or-map-by-the-current-record.png</a></td><td><a href="https://docs.avonnicomponents.com/flow/tutorials/tips-and-tricks/filter-a-data-table-or-map-by-the-current-record.md">Filter a Data Table or Map by the current record in a screen flow</a></td></tr><tr><td><strong>Test a screen flow that needs a record Id</strong></td><td>Debug with a real Id before you add the flow to a page, and see why recordId is blank from Setup.</td><td><a href="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FTpQ2UklxkGXelu5MVutJ%2Frecordid-cover-test-a-screen-flow-that-needs-a-record-id.png?alt=media">recordid-cover-test-a-screen-flow-that-needs-a-record-id.png</a></td><td><a href="https://docs.avonnicomponents.com/flow/tutorials/tips-and-tricks/test-a-screen-flow-that-needs-a-record-id.md">Test a screen flow that needs a record Id</a></td></tr><tr><td><strong>Pass the record Id to a flow opened in a panel</strong></td><td>Open a second flow in a side panel from a Data Table row and hand it that row's Id.</td><td><a href="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2Ff3RjlAsk3j8jHBngoe49%2Frecordid-cover-pass-the-record-id-to-a-flow-opened-in-a-panel.png?alt=media">recordid-cover-pass-the-record-id-to-a-flow-opened-in-a-panel.png</a></td><td><a href="https://docs.avonnicomponents.com/flow/tutorials/tips-and-tricks/pass-the-record-id-to-a-flow-opened-in-a-panel.md">Pass the record Id to a flow opened in a panel</a></td></tr><tr><td><strong>Screen flow or record-triggered flow</strong></td><td>Which flow type fits the job, and why {!$Record} does not work in a screen flow.</td><td><a href="https://27923732-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1FUd4apB9YHgCEMUFbVb%2Fuploads%2FfnDpIfxNvoJoHLjY8I9u%2Frecordid-cover-screen-flow-or-record-triggered-flow.png?alt=media">recordid-cover-screen-flow-or-record-triggered-flow.png</a></td><td><a href="https://docs.avonnicomponents.com/flow/tutorials/tips-and-tricks/screen-flow-or-record-triggered-flow.md">Screen flow or record-triggered flow: recordId vs $Record</a></td></tr></tbody></table>

## FAQ

### How do I test the flow with a record Id (Debug)?

Click **Debug** in Flow Builder and type a real record Id in the `recordId` field of the Debug panel. Copy the Id from the record's URL. Step-by-step: [Test a screen flow that needs a record Id](https://docs.avonnicomponents.com/flow/tutorials/tips-and-tricks/test-a-screen-flow-that-needs-a-record-id.md).

### Why is recordId empty or null?

`recordId` is empty when nothing passes a record Id to the flow. Either the **Pass record ID into this variable** checkbox is not checked, the variable is not named exactly `recordId`, or the flow was started outside a record page. The [Problems](#problems) section lists each cause and its fix.

### Can I get the whole record instead of the Id?

Yes. The simplest way is a Get Records element with `Id` Equals `{!recordId}`, which gives you every field of the record. From a Quick Action you can also skip that element: create `recordId` as a **Record** variable (Data Type **Record**, Object set to the page's object, **Available for input**) and the action passes the whole record. See [Use the recordId in your flow](#use-the-recordid-in-your-flow).

### Does it work in the Salesforce mobile app?

Yes: the Flow component on a Lightning record page and a Quick Action added to the layout both run in the Salesforce mobile app.

To run Avonni components in a flow on an Experience Cloud site, see [Avonni Flow Screen Components in Experience Cloud](https://docs.avonnicomponents.com/flow/getting-started/using-the-avonni-flow-screen-components-in-experience-cloud.md).

### Why does {!$Record} not work in a screen flow?

`{!$Record}` is the record that started a triggered flow, and a screen flow has no triggering record. Use the `recordId` variable instead. The full comparison is in [Screen flow or record-triggered flow](https://docs.avonnicomponents.com/flow/tutorials/tips-and-tricks/screen-flow-or-record-triggered-flow.md).

***

## Related tutorials

* [Quickstart guide](https://docs.avonnicomponents.com/flow/getting-started/quickstart-guide.md): a complete flow on the Account page, built on `recordId`.


---

# 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/tips-and-tricks/how-to-pass-your-current-recordid-in-your-screen-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.
