Is there a way in LWC, to call flow from web components. I have a task where I need to add flow into Global action traditionally its not possible with salesforce out-of-box functionality. I'm able to do it via aura component. I wanted to know if there is a way to implement it in LWC.
Embedding flows in LWC is currently not supported.
The current workaround is to use aura component that can embed flow using
lightning:flow component. The aura component can also embed an lwc component so that should allow you to still build everything else as lwc component.
The other way round that is embedding LWC in lightning flows is possible.
You will need to make sure your LWC has a target config defined for flows. An example .js-meta.xml file will be as below
<targetConfigs> <targetConfig targets="lightning__FlowScreen"> <property name="startDate" label="Start Date" type="Date" role="inputOnly"/> <property name="account" label="Account Chosen" type="@salesforce/schema/Account"/> <property name="annualRevenue" label="Annual Revenue" type="Integer" role="outputOnly"/> <property name="name" label="Account Name" type="String" /> </targetConfig>
Also, take a look at
lightning-flow-support lwc component. It provides events that enable a component to control flow navigation and notify the flow of changes in attribute values.
Salesforce recently launched whole automation components recipe that has plenty of examples.
For global action override one could just use flows and flows can have lwc in them.