This component enables to execute any Flow in a dedicated Lightning Tab (with proper layout) and automatically redirect the user to a target page determined as output of the Flow after having possibly forced a Lightning Data Service data refresh of some records (also determined by the Flow).
By default, the flow is launched within a standard Lightning Tab.
Most parameters are provided as state parameters (see URL) when redirecting the user to this page, these parameters being used by the component or pushed as input parameters to the Flow.
In order to use the component, a Lightning Tab should be configured in Setup.
Notes:
- At least one such Tab needs to be configured.
- The label configured corresponds to the tab being displayed in the App and admins may define different tabs to have labels matching the process executed in the Flow.
Opening the Lightning tab may be done in various ways.
Via the Lightning navigation service, the target page reference is simply:
{
"type":"standard__navItemPage",
"attributes": {
"apiName":"TST_Name"
},
"state":{
"c__flow":"TST_Flow",
"c__target":"target",
"c__isDebug":true,
"c__inputText":"Test"
}
}
In this exemple,
TST_Name
is the API Name of the Lightning Tab hosting the flow executionc__flow
(mandatory) provides the API name of the Flow to be executedc__target
(optional) provides the name of the Flow output field to be used to fetch the IDs of the records to refresh upon Flow terminationc__target
(optional) enables to activate debug logs- all other
state
parameters are considered asString
input parameters to the Flow with (c__inputText
being pushed asinputText
flow parameter)
c__
prefix in state paremeters is required so that their corresponding values are properly pushed to the Tab.
The contextualised URL of the previous example may be easily built as follows:
/lightning/n/TST_Name?c__flow=TST_Flow&c__inputText=Test&c__target=target&c__isDebug=true
More generally, URL buttons may be configured on record page to launch the Flow in a contextualised way.
This component relies on the following standard base Lightning components and methods:
- lightning-flow component for Flow execution and completion tracking
- lightning-navigation component for navigation to target pages
- notifyRecordUpdateAvailable method of the Lightning Data Service to refresh its record data cache