Flow & Subflow
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
53m ago
As a beginner, I understand what Flows and Subflows do individually, but how do I know when I should use a Subflow instead of keeping everything inside one Flow?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
28m ago
Hi @AyoubF
https://www.servicenow.com/docs/r/build-workflows/workflow-studio/when-to-use-flow-types.html
| If... | Then create... |
|---|---|
| You need a constant input to initiate a set of actions | A flow |
| You need a variable input to initiate a set of actions | A subflow |
| You want to start a flow by calling it from another flow or script | A subflow |
| You want to reuse a set actions in other flows | A subflow |
| You want to configure different types of inputs for each call | A subflow |
| You want to specify the inputs available to a subflow when it starts | A subflow |
| You want to specify the outputs available to a parent flow after a subflow ends | A subflow |
| You have a large flow with 25 or more actions and want to improve its performance and readability | Subflows |
| There are interrelated outputs or some action must be taken when all are available | Parallel subflows |
| There are not interrelated outputs or some action must be taken when all are available | Multiple flows triggered by a single event |
| You want to correct certain errors in your record data automatically | A subflow |
| You want to avoid the limit of 10 items in the error-handling-process | A subflow |
| You want to use subflow outputs to trigger automation in other flows | A subflow |
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
23m ago - last edited 22m ago
Hey @AyoubF
I would suggest following a simple approach: use a Flow to manage the overall business process and a Subflow to handle reusable or logically independent operations.
Here is how I decide between them:
Use a Flow when:
- You are implementing a specific end-to-end business process.
- The logic is used only in that particular process.
- The steps are straightforward and easy to maintain.
- There is no requirement to reuse the same logic elsewhere.
Use a Subflow when:
- The same logic needs to be reused across multiple Flows.
- You have a group of actions that perform a specific business operation.
- The main Flow is becoming too complex and difficult to maintain.
- You want to centralize common logic and avoid duplication.
Practical Example:
Consider an Incident Management process:
Main Flow:
- Trigger when an Incident is created.
- Check Incident priority.
- Assign the appropriate group.
- Call a Subflow to send notifications.
- Update the Incident.
Now, suppose the same notification logic is also required in Change Management and Service Catalog processes.
Instead of duplicating the notification steps in every Flow, create a reusable Subflow called Send Notification and call it wherever required.
My Recommendation:
Before creating a Subflow, ask yourself:
- Will I reuse this logic in another Flow?
- Does this functionality represent an independent business operation?
- Will separating it improve readability and maintenance?
If the answer is yes, consider using a Subflow. Otherwise, keeping the logic within the main Flow is perfectly fine.
In short:
Flow = Manages the overall business process.
Subflow = Handles reusable or logically independent operations.
The goal should be to keep your Flow simple, readable, reusable where necessary, and easy to maintain. Avoid creating unnecessary Subflows for every small operation.
*************************************************************************************************************************************
If this response helps, please mark it as Accept as Solution and Helpful.
Doing so helps others in the community and encourages me to keep contributing.
Regards
Vaishali Singh
Linkedin - https://www.linkedin.com/in/vaishali-singh-2273361bb