Platform / Lightning Flow
Parent screen flow output variable returns null to LWC when the only Screen is in a subflow and the parent ends on non-interactive elements
- Reported
- Nov 30, 2026
- Updated
- Nov 30, 2026
- Fixed
- —
- Reports
- 0
- Found in
- Winter '27
- Reference
- W-24544850
Summary
When a parent Screen Flow is launched from an LWC via lightning-flow, a configured output variable comes back as null at the FINISHED event if the flow's only interactive Screen is in a subflow and the parent flow finishes on non-interactive elements (such as Get Records followed by Assignment). The same flow returns the value correctly in Flow Debug.
- Actual Result
The flow status is FINISHED and the output variable is included in outputVariables, but its value is null. No error is thrown.
- Expected Result
The output variable returns the value assigned in the Assignment element.
Workaround
Add any Screen in the parent after the Assignment, or reorder to Get → Assign → Subflow.
Steps to reproduce
1. Create a simple Screen Flow with one Screen element that displays text, then save and activate it. This flow will be used as the subflow.
2. Create a parent Screen Flow named test_lwc_output_parent_flow, add the elements as described in the following steps so that the flow path is Start → Subflow → Get Records → Assignment → End, and then save and activate the flow.
2.1 Add a Subflow element that calls the flow created in Step 1 as the first element after Start.
2.2 Add a Get Records element after the Subflow element to retrieve a single record from any object that has a Name field. Make sure that at least one matching record exists.
2.3 Add an Assignment element after the Get Records element to store the retrieved record's Name field in a Text variable named storeName that is marked as Available for Output.
3. Create an LWC named lwc_call_button using the code below. It launches the parent flow and reads its output variable.
3.1 Deploy the LWC to the org.
3.2 In Lightning App Builder, add the Call Button component to a Lightning page (Record, App, or Home page), then save and activate the page.
4. Run the flow from the LWC and check the output variable.
4.1 Open the page, open the browser developer console, and click Search Customer.
4.2 On the screen displayed by the subflow, click Next.
4.3 Actual result: the console shows "storeName = null".
4.4 Expected result: the console shows the Name of the retrieved record, as it does when the same parent flow is run in Flow Debug.
LWC code:
lwc_call_button.js
import { LightningElement } from 'lwc';
export default class LwcCallButton extends LightningElement {
flowName = 'test_lwc_output_parent_flow';
showScreenFlow = false;
storeName;
handleSearchCustomer() {
this.showScreenFlow = true;
}
handleFlowFinish(event) {
const { status, outputVariables } = event.detail;
if (status === 'FINISHED') {
this.storeName = outputVariables?.find(v => v.name === 'storeName')?.value;
console.log('storeName =', this.storeName);
this.showScreenFlow = false; // hide the flow once it's done
} else if (status === 'ERROR') {
console.error('Flow error:', event.detail);
}
}
}
lwc_call_button.html
<template>
<lightning-button
label="Search Customer"
icon-name="utility:search"
icon-position="left"
variant="neutral"
>
</lightning-button>
<template lwc:if={showScreenFlow}>
<lightning-flow
flow-api-name={flowName}
>
class="slds-is-relative">
</lightning-flow>
</template>
</template>
lwc_call_button.js-meta.xml
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata">
<apiVersion>66.0</apiVersion>
<isExposed>true</isExposed>
<masterLabel>Call Button</masterLabel>
<description>Button that launches the parent screen flow and reads its output.</description>
<targets>
<target>lightning__RecordPage</target>
<target>lightning__AppPage</target>
<target>lightning__HomePage</target>
</targets>
</LightningComponentBundle>
Status timeline
Nov 30, 2026
created · In Review · 0 reports
Nov 30, 2026
content changed · In Review · 0 reports