Flow: How To Use “Subflow”

The concept of subflow should be easy to understand – when you want to launch a flow inside another flow (main flow), it is a Subflow. However, the timing to use a Subflow is a more difficult question. There might be many possibilities, but the most common case is when you have many flows and in each of them there is the same set of actions, you can make that set of actions into a Subflow so you do not need to create those actions again and again.

flow subflow - explanation chart

Note that Subflow element is only available in a Screen flow or a Scheduled-Triggered flow. Let’s go through the steps of setting up Subflow. (Want to learn more about different flow types? Check here)

1. Choose The flow To Launch As Subflow
flow subflow - setup

The referenced flow must be activated before you can find it here, so make sure you make the subflow first and the main flow afterwards.

2. Set Input Values
flow subflow - set input

If you have any allowed-for-input variables in the subflow, you can assign their value here. (What is allowed-for-input variables? Check here)

3. Manually Assign Output Variables (If Needed)
flow subflow - store output

By checking “Manually assign variables”, you can save the output variables of the subflow (if there is any) at the chosen variables. Otherwise you can find the output variables as “Outputs from [API name of the Subflow]“.

Use Case Of Manually AssigningExplanation
You want the variable to have a neat name to reference it later.As the name of the auto-generated variable is very length, you can use this option to make the variable more readable.
You want to save the value in an output-allowed variable.
The auto-created variable is not allowed for output. If you want to use this functionality, create a output-allowed variable and assign it manually.
Review again on input/output-allowed variable!
Check Out How Subflow Can Be Used In Real Cases!
No posts found.

Official Salesforce Help Article On Subflow

Subscribe
Notify of
guest

4 Comments
Oldest
Newest Most Voted
Inline Feedbacks
View all comments
Deepak Adhikari

Thanks the info about subflow, There have been some scenarios that I have sent you, which I am unable to work with the subflow variables let alone pass variable from main flow to the subflow. Would you kind enough to help me by replying my 2 last emails, where you have flowchart and my not working flow design in pictures.

volovitch

I had the problem that “manually assign variable” was not present. I reloaded the flow and it appeared.

Last edited 2 years ago by volovitch
Karthik Nallajalla

FYI – From Winter ’22, a record trigger flow should be able to call a Subflow

Call Another Flow from a Record-Triggered Flow Using a Subflow Element (salesforce.com)

Tornubari

HI FlowSome,

I love you work. I was following this article just a heads up it appears the link Review again on input/output-allowed variable! (https://salesforce-flowsome.com/flow-how-to-use-availability-outside-the-flow-input-output/(opens%20in%20a%20new%20tab) is broken it results in page not found for me.