The concept of “helper” Flow is more of a strategy than something that needs to be done. The idea is to have Flows with pieces of functionality that you can re-use on your other Flows. Some people call it auxiliary Flows, so it’s up to you to pick the one you like.
I’m going to focus on the strategy since, after that, there’s a lot of ways to organize your Flows in the best way that makes sense for you. In the end, I want you to save time and effort and focus on building cool Flows and not maintaining them.
Strategy and Concepts
Let’s look a bit at the strategy and concepts to understand why helper Flows are so useful.
Separation of responsibility
The main concept that I want you to understand is the separation of responsibility. It’s used by many developers and development frameworks, but the concept is simple and can be used by us.
So what is “separation of responsibility?” It’s when we have a Flow that does only one thing but does it well. And no other Flow does that. Let’s use an analogy to drive the concept home. Let’s think about surgery. You have an anesthesiologist who only focuses on keeping the person sedated, the surgeon who does the actual surgery, the other staff that helps provide the equipment, the cleaning staff that made sure that the OR is clean, the team that makes sure that everything is working, etc. There are responsibilities for each person, and no one does something else because they would not be the right person for the job.
Now let’s say that you have a Flow that collects information from a CSV file, transforms the data based on rules, and adds the rows to a SharePoint list. Your Flow will have 2 main responsibilities:
- First, parse the CSV file to get the values.
- Second, process the values and insert them in a SharePoint list.
It would be a lot better if the Flow only did what it’s supposed to. Then, process the values and insert them in a SharePoint list.
That’s where the “Helper” Flow comes into play. We can remove the “parse the CSV” from the Flow and put it in a helper Flow. Then we call it using the “Run a Child Flow” action, for example. This way, we get the “Child” Flow to do something complex and the main Flow to focus on what it needs to do.
Another huge advantage of separating Flows is the duplication. For example, I’ve developed a Flow that Parses HTML to find all links and download files. This Flow has many steps, but one of them is finding the start and end of an HTML tag. Since I need to do this in many places, it’s a waste of resources to keep on repeating the actions along with the Flow. Having separate Flows to perform certain actions will make it so that the “Child” or “Helper” Flow does all the work as a “black box” and returns what we need. This way, the main Flow “delegates” the responsibility of doing something to the Child Flow without “caring” how it’s done.
Making things a lot simpler
Having separation makes things a lot simpler since we remove a lot of actions from each Flow. A helper Flow will contain only one “copy” of the actions, and it can be called as many times as needed along with the main Flow. You replace a lot of actions with only one, the “Run a Child Flow” action. Doing this is huge in terms of:
- Readability – The Flow becomes a lot easier to read since it has a lot fewer actions.
- Debugging – If something goes wrong, having fewer actions make things a lot easier to read and understand where we have a problem.
- Control – you have more control over the Flow to do proper error handling and understand how your Flow behaves.
- Fewer mistakes – If something is simpler, then we will make fewer mistakes. Mistakes can be hard to solve since the actions of a Flow can be permanent.
Simpler is always better, so making things simple is a huge plus in my book.
Reusability of Work
Having this separate also enables you to re-use your work. You develop a helper Flow once, and you can use it in all the other Flows you need. Going back to the parse CSV example, if you have a helper Flow where you Parse the CSV file to get the values, you can use it multiple times and in multiple places regardless of how complex it is.
Reusing work is the best way to save time since you only do something once.
Finally, maintenance is improved. Since you have things separate, it’s a lot easier to maintain your Flows. For example, imagine that your ”Parse the CSV file to get the values” helper Flow is not working properly. You can go to one place, debug and fix it, and it’s automatically updated everywhere you call it. Also, improving the Flow is easy since it only exists in one place, so if you want to add more features, you can do them in one place, and all other Flows benefit from that change.
Maintaining Flows is hard, so the separation helps you make things a lot more manageable, and again it will save you a lot of time.
Now that we defined the concepts, it’s easy to understand why helper Flows are so useful. I have a section dedicated to templates that are no more than helper Flows that I build to make my life easier.
I would advise that you look at your own Flows and think about the ones that can become helper Flows. Also, think about sections in your Flows that could be aggregated into a single Flow. I’m sure that you’ll find a lot of them.
Finally, please let me know about your cool helper Flows. I’ll feature them here, and it’s fun to learn from your, and I’m sure other people will appreciate it as well.
Photo by Neil Thomas on Unsplash