Passing recordId and record data into a Salesforce Screen Flow — how and best practices

Why you’d pass the record into a screen flow

Screen flows often run on record pages or are launched from record actions. Passing the current record context to the flow lets you show pre-filled UI, validate record fields, or update related records. The simplest and most robust approach is to pass the current record’s Id and then fetch only the fields you need inside the flow.

How to pass the current record Id to a Screen Flow

There are multiple ways to pass the record Id depending on how you launch the flow:

1) Embedded on a Lightning Record Page (recommended)

Create a flow variable:

API Name: recordId
Data Type: Text
Availability: Available for input

Place the flow on the Lightning Record Page using the Flow component. When the flow variable named recordId (exact name) exists and is available for input, the Lightning Flow component automatically passes the current record Id to the flow.

2) Object Quick Action / Action on Lightning Record Page

If you add the flow as an Object Action or Quick Action (Action type = Flow) it will also pass the record Id automatically to an input variable named recordId in the flow. Again make sure the flow variable is available for input and named recordId.

3) URL / Custom Button (Classic & Lightning-compatible URL)

Launch the flow via a URL button and pass the Id as a URL parameter. Example:

/flow/My_Screen_Flow?recordId={!Account.Id}

In the flow create a Text variable recordId (Available for input) to receive it.

4) Programmatically from Aura or LWC

Use the Lightning Flow component APIs to start the flow and supply input variables:

// LWC example
const inputVariables = [
{ name: 'recordId', type: 'String', value: this.recordId }
];
this.template.querySelector('lightning-flow').start(inputVariables);

// Aura example
var flow = component.find('flowData');
flow.startFlow('My_Screen_Flow', [
{ name: 'recordId', type: 'String', value: component.get('v.recordId') }
]);

Is it possible to send the full record (SObject) into a Flow?

Short answer: usually you should pass the Id and query the fields inside the flow. Technically, passing a full record is possible only in specific scenarios and not by the automatic Flow component on the Lightning Record Page. Details:

Scenarios

Embedded Flow / Quick Actions / URL: When using the Flow component on a Lightning record page or adding the flow as a page/action, Salesforce automatically passes only the recordId. The Flow component does not automatically pass the entire SObject record.

Programmatic launch (Apex / Autolaunched / LWC/Aura): If you start a flow programmatically you can supply more complex inputs. For example, when calling a flow from Apex using Flow.Interview (autolaunched flows), you can pass an sObject instance into a flow variable defined as a Record (object type must match) and set the variable Available for input.

// Apex (autolaunched flow example)
Account a = [SELECT Id, Name, Industry FROM Account WHERE Id = :someId];
Map inputs = new Map{ 'accountRecord' => a };
Flow.Interview.My_Autolaunched_Flow interview = new Flow.Interview.My_Autolaunched_Flow(inputs);
interview.start();

Note: Flow.Interview is typically used for autolaunched flows. Using Apex to start screen flows is not supported in the same way for interactive screens shown to users—you generally launch screen flows from the UI and use input variables as shown above.

LWC/Aura programmatic start of Screen Flow: You can pass structured input variables via start(inputVariables). Passing a record-shaped object to a Flow variable typed as Record can work when the runtime expects it, but it’s fragile: matching the structure, field names, and types is required and comes with serialization considerations.

Recommended best practice

– Prefer passing recordId and then use a Get Records element in the flow to retrieve only the fields you need (simpler, less error-prone, respects FLS).
– Only pass a full SObject when you must and you’re launching the flow programmatically (Apex/LWC) and control both sides of the contract.
– Keep variables “Available for input” and ensure correct data types (Text for Id, Record for SObject typed variables).
– Avoid sending large data payloads into flows — flows are better with minimal inputs and fetching required data inside the flow.

Security & performance notes

When you fetch records inside the flow, the flow runs in the running user’s context unless configured otherwise — enforce field-level security by using Get Records and respecting object/field permissions. Passing a full sObject might bypass explicit reads inside the flow and can lead to exposing more fields than needed.

Summary

– To get the current record into a Screen Flow, create a Text variable named recordId that is Available for input; the Lightning Flow component and Quick Actions will populate it automatically.
– Passing the entire record is technically possible when launching programmatically (Apex/LWC) into a flow variable typed as a Record, but it’s generally better and safer to pass the recordId and query the fields you need within the flow.