Skip to main content

Flow Wiring

Every Screen Flow that uses a Keelstone LWC component must receive KeelstoneSessionId as a flow input variable and pass it to each component. Keelstone injects this value automatically when launching the flow — you only need to declare it and wire it.

1. Add the flow variable

In your flow's XML, add this variable declaration:

<variables>
<name>KeelstoneSessionId</name>
<dataType>String</dataType>
<isCollection>false</isCollection>
<isInput>true</isInput>
<isOutput>false</isOutput>
</variables>

In Flow Builder: Manager tab → New Resource → Variable, type String, input only.

2. Wire it to each component

For every Keelstone LWC on a screen, add an input parameter:

<fields>
<name>cmpMyComponent</name>
<extensionName>kstone:myComponent</extensionName>
<fieldType>ComponentInstance</fieldType>
<inputParameters>
<name>keelstoneSessionId</name>
<value><elementReference>KeelstoneSessionId</elementReference></value>
</inputParameters>
<isRequired>true</isRequired>
</fields>

In Flow Builder: select the component on the screen, find Keelstone Session ID in its properties, and set the source to the KeelstoneSessionId variable.

3. Re-declare in your LWC

Salesforce flow wiring only populates @api properties declared on the component class itself. Inherited properties are not wired. Add this to every component that extends a Keelstone class:

import { KSExcel } from 'kstone/api';
import { api } from 'lwc';

export default class MyComponent extends KSExcel {
@api keelstoneSessionId; // required — flow wiring won't work without this
}

And expose it in .js-meta.xml:

<targetConfigs>
<targetConfig targets="lightning__FlowScreen">
<property name="keelstoneSessionId" type="String" label="Keelstone Session ID" />
<!-- your other properties -->
</targetConfig>
</targetConfigs>

Quick-action flows (record context)

Flows launched from a Salesforce Quick Action on a record page also receive recordId as a separate input. Both variables are required:

<variables>
<name>recordId</name>
<dataType>String</dataType>
<isCollection>false</isCollection>
<isInput>true</isInput>
<isOutput>false</isOutput>
</variables>

<variables>
<name>KeelstoneSessionId</name>
<dataType>String</dataType>
<isCollection>false</isCollection>
<isInput>true</isInput>
<isOutput>false</isOutput>
</variables>

Sample flows

The Keelstone-Samples package includes flows with this wiring already in place:

FlowComponents wired
Keelstone_Query_BuilderqueryBuilderLwc
Keelstone_Account_ReportaccountDataFetcher, keelstoneGenerateDocument
Keelstone_Account_SearchaccountSearch, excelTemplate

Use these as a reference when building your own flows.