Flow Action: Call Subflow

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:

ParameterUse for InputUse for OutputDescription
Flow API NameAPI name of the flow.
Flow NamespaceNamespace of the flow. Leave the input blank if the flow does not have a namespace.
JSON of Input VariablesJSON 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:
https://github.com/forcePanda/Flow-Repo/tree/master/Apex%20Actions/Call%20Subflow

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. 🙂

One thought on “Flow Action: Call Subflow

  1. Pingback: Winter ’21 – Introducing the Before Delete Record-Triggered Flow – Jenwlee's Salesforce Blog

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.