Working with subflows
STANDARD PREMIUM ULTIMATE
Create reusable building-blocks with Subflows
Subflows help to increase readability of a flow and are a great tool to avoid duplicated logic. In addition, Subflows are an easy method to build your own reusable nodes directly within the Flow Editor.
Subflows enable you to create reusable flows by encapsulating them as a single node.
When building a flow, you might identify common elements that you'd like to reuse in multiple places. By creating Subflows, you can avoid having multiple copies of those common parts spread across your flows as they could become harder to maintain, as you end up with multiple places to apply fixes and could easily overlook one.
Subflows allow you to build custom nodes in a low-code manner, and any changes made to a Subflow are automatically propagated to all instances of that node within your flow app.
Subflows can have a custom name, version, and UI configuration properties. All details are stored in your flow.json, making it easy to export or import.
![]() Subflow placed in a flow | ![]() Subflow Template Edit View |
---|
How to create a Subflow
To create a subflow, perform the following steps:
Click on the menu icon in the top-right of the screen of the Flow Editor.
Click on Subflows>Create Subflow or Subflows>Selection to Subflow
Once you have created a subflow, you will find
Configuration of Subflow Template
To access the subflow template, double-click on the node in the sidebar. This will open a new tab for this subflow which gives you access to the node in the subflow as well as the subflow properties.
Subflow Properties
The workspace of a subflow has a dedicated menu bar at the top. There you can access the subflow Properties. This option opens a different window for node options. This one also lets you create environment variables. Those environment variables will affect every node of this particular subflow that is used in the project. The Properties tab lets you change the name for this subflow. It can be overwritten for single nodes if this subflow by setting a name in the options tied to this specific node. The subflow template can also be moved to a specific existing or new category. The remaining setting options hardly differ from the usual set of options for a node.
Editing nodes in a subflow
The menu bar in the workspace lets you add inputs and output. They appear as a node and can be placed in the workspace to connect to. There can only be one input. You can also add a status node that will display a status outside of the subflow whenever it is triggered. The status display can be created with a shape of the indicator, its color, and a status text.
msg.payload = {fill:"green",shape:"dot",text:"hi"}
msg.payload = {fill:"red",shape:"ring",text:"status"}

Subflow Template Edit View

Example use of subflow within a flow
You can add nodes to the workspace of the subflow just like a normal flow. There are a few limitations to the subflow environment. As mentioned before, a subflow can only have one input. You have the option to add in- and outputs. The number of outputs has no limit.
Node buttons are disabled inside subflows. The node will still work, but you can't trigger an inject node or enable or disable a debug node.
Deleting a subflow
Subflows have different states of being deleted.
You can remove a subflow from your flow like any other node. This means an instance of the subflow template was removed. The subflow template still exists in the left sidebar and can be used again.
To delete the subflow completely, open the subflow template by double-clicking on the node in the sidebar and click on “delete subflow” button in the top menu.