This LWC component enables to trigger a Flow embedded within a page instead of a popup as with standard Quick Actions. Its main benefit compared to the standard Flow App Builder component providing similar functionality is to avoid loading and initialising the Flow definition at initial page rendering if the user does not necessarily need to launch the flow.
It also enables to launch the flow in a popup for all non record pages (i.e. Home or App) as Flow global actions are (still) not available.
By default, a single action button is displayed.
When the user clicks on the button, if popup display has been configured, the component opens a popup to execute the Flow.
Otherwise (if popup mode not configured), the component toggles in execution mode with the Flow embedded within it. Similarly to he popup a close icon button is displayed on the top right to stop the flow.
Upon completion/closing of the flow, the component gets back to the original state (with a single button displayed).
The component is easily configurable from the App Builder.
As a baseline, the following elements are configurable
Flow Name
to provide the API Name of the flow tp executeFlow Input
to configure various input parameters for the Flow- as a JSON list of
{"name":"...","type":"...","value":"..."}
records - with
recordId
andobjectApiName
names being automatically populated from page context if requested (e.g. via a simple{"name":"recordId"}
item)
- as a JSON list of
Output Field for Refresh
to define the Flow output field providing a list of record IDs for which a Lightning Data Service data refresh is requested- this field should be a
String
multi-value Flow variable available for output - no refresh being triggered if no field name is set is defined or in case of empty output field value.
- this field should be a
Start Button Label
providing the label of the main button to launch the FlowStop Button Title
providing the title of the close button icons (to stop the Flow)- Various elements dedicated to the popup mode:
Popup ?
to activate this modePopup Label
to set the Popup header labelPopup Size
to set the popup width
Wrapping CSS
to define the styling of the main containing div of the component.
The following Wrapping CSS
values enable to configure the component display differently.
slds-box slds-box_small slds-theme_default slds-grid slds-grid_align-end
is the default value and aligns the start button to the right within a standard box.slds-box slds-theme_shade slds-grid slds-grid_align-start
enables to locate the button to the left within a greater shaded box.
The following Flow Input
value enable to set multiple Flow input variables statically and dynamically.
```[{"name":"recordId"},{"name":"objectApiName"},{"name":"inputText","type":"String","value":"TEST Standard"}]````
The Flow should have at least 3 text variables available for input
recordId
which will dynamically receive the ID of the current page record (if any)objectApiName
which will dynamically receive the Object API Name of the current page record (if any)inputText
which will receive the configured text value (hereTEST Standard
)
This component relies on the following standard base Lightning components:
- lightning-flow for Flow execution and completion tracking
- lightning-modal for popup management (via a the sfpegFlowPopupDsp subcomponent)
- notifyRecordUpdateAvailable method of the Lightning Data Service to refresh its record data cache