How to pass your current RecordID in your screen flow
How to do it from a Lightning Page or a Quick Action
Overview
When you build automation with Salesforce Flow Builder, you often need your flow to interact with the record a user is currently viewing. To do this, you must pass the record's ID into your flow. This lets your flow access and work with the correct data.
This guide shows you how to easily pass the current record's ID into your screen flow so you can use it to update fields, create related records, or perform other actions.
Configuring a Flow in App Builder to Receive the Current Record ID
The steps to pass the RecordID are as follows:
1. Create the flow Variable
First, you must create a flow variable to store the RecordID value. Make sure to make the flow variable is available for input
.
Open the Flow Builder Toolbox
Click on the "
New Resource
" buttonSelect "
Variable
" as a resource typeEnter an API Name
Select the appropriate object to which you'd like to pass this RecordID to.
Check the "
Available for Input
" checkboxClick "Done"
2. Check the RecordID option from the app builder page
Drag and drop the Flow element on the app builder page and select the relevant flow to be displayed.
Select “
Pass all field values from the record into this flow variable
” to send all the field values into the created variable.
Problems?
If you don't see the RecordID checkbox in App Builder, please complete Step 1 first.
Configuring a Quick Action to Pass the Record ID to a Flow
To pass a record ID to a Flow launched from a Quick Action, follow these steps:
1. Create the Record ID Variable in the Flow
Open your Flow in Flow Builder.
Click the "Manager" tab on the left panel.
Click "New Resource" and select "Variable."
Enter a name (e.g., "recordId") and set the Data Type to "Text."
Check the "Available for Input" checkbox to make it an input variable.
Click "Done."
2. Create and Configure the Quick Action
In Salesforce Setup, navigate to the object where you want to add the Quick Action (e.g., Account, Contact, Opportunity).
In the "Buttons, Links, and Actions" section, click "New Action."
Action Type: Select "Flow."
Flow: Choose the flow you created in step 1.
Label: Give your Quick Action a descriptive label (e.g., "Launch My Flow").
Name: This will be auto-populated based on your label.
Description: (Optional) Add a brief description.
Set Input Values:
Click "Add Input Variable."
Flow Variable: Select the
recordId
variable you created in the flow.Type: This should be "Field Reference."
Value: Select "recordId". This maps the Quick Action's built-in
recordId
to your flow variable.
Save the Quick Action.
3. Add the Quick Action to the Page Layout
Navigate to the Page Layout of the object where you want to add the Quick Action.
In the "Salesforce Mobile and Lightning Experience Actions" section, drag and drop your new Quick Action to the desired location on the page layout.
Save the Page Layout.
4. (Optional) Use the Record ID in Your Flow
In your flow, you can now use the
recordId
variable in elements like "Get Records" to retrieve the current record or related data. For example:Add a "Get Records" element to your flow.
Set the "Object" to the object you're working with (e.g., Contact).
In the "Filter Criteria," set the condition to "ID Equals
recordId
".This will retrieve the specific record whose ID was passed from the Quick Action.
You're done! Now, when you click the Quick Action on a record page, it will launch your flow and pass the current record's ID, allowing your flow to work with that specific record.
Last updated