Hi there! 🙋🏻♂️
Are you confused why we are talking about an Apex action that call another flow when we already have a ‘Subflow’ element in flows? Well, allow me…
If you’ve already started playing around with Record Triggered or Platform Event triggered flows, you might have noticed that the Subflow element is missing for them. Yes, so for the time being, we cannot call subflows in the above specified flow types. Quite a bummer!
Not to worry though! Apex actions to our rescue again.
How does it work?
So I’ve built an Apex action that enables you to call a flow as a ‘subflow’.
The action takes follow values as input/output:
|Parameter||Use for Input||Use for Output||Description|
|Flow API Name||✅||API name of the flow.|
|Flow Namespace||✅||Namespace of the flow. Leave the input blank if the flow does not have a namespace.|
|JSON of Input Variables||✅||JSON string of flow input variables and their corresponding values.|
Ex: If your flow has two input variables; varText(text type) and varNumber(number type), then the JSON should look like this.
“varText” : “Text Input”,
“varNumber” : 3000
Store the JSON string in a variable using a Text type variable or a Text Template(with View as Plain Text) and pass that variable in the action input.
This action can prove to be very handy for calling for error handling flows and for many more use cases.
You can find the link for the unmanaged package and source code here:
Quick Demo? Of course!
Hope you found this one useful! Catch you in the next one! ✌
Thank you for being an awesome reader! Subscribe to this blog for receiving all the latest updates straight to your inbox. 🙂