December 19, 2024

While scrolling on my Twitter feed I found this piece of amazing news in how to run a child flow.

Best practices dictate that we should only do something once. It bothered me that, if I wanted to re-use logic from Flow to Flow, I needed to do one of 2 things:

  1. Duplicate the steps – Horrible solution since it’s a nightmare for maintenance. Gave up this quite quickly.
  2. Request trigger – Another solution would be to use a request trigger and call the Flow using an HTTP Post or Get Request.

Both solutions look (and are workarounds) and there was no good solution to call other Flows using them as “Functions”, aggregating logic that can be used, changed and maintained in a single place.

Until now.

There’s a new action that allows just that. The “Run a Child Flow”.

This action allows you to call another Flow and even pass the arguments to it. Awesome, so far, but there’s a caveat.

The caveat

This is only available if you create a “Solution”. I’ll go into further detail in the future on what is a “Solution”, but for now, think of it as a logical grouping of flows (but not only flows) in a nice package. If you try to find that action while building a Flow outside a Solution you won’t find it. I can speculate why, but for now, let’s use it and have some fun.

How to use it?

Let’s start with the “Solution”.

Create the Solution

You can find the “Solutions” area in your side menu:

Name it

In this case, I prefer to use the predefined publisher (text is in Portuguese but you should see it as “Predefined Publisher for orgXXXXX”), but you can create a new one. Again, I’ll go into much more detail regarding “Solutions” soon in another post.

Add a version

Note: The version should be in the X.X.X.X format. For more details, check this article regarding version rules and best practices.

We have an empty “Solution”.

Create the Flows

First, let’s create the Flow that will contain the logic that we’ll reuse.

As mentioned before, a “Solution” is more than a group of Flows, as you can see above, but let’s focus on the Flow for now.

To demonstrate, we’ll create a Flow that receives an input, trims it, and returns it back. I know it’s simple and it’s just for demonstration purposes but you could think of a Flow that parses texts based on your company’s naming conventions, for example. This would keep consistency and would be useful in many instances.

Here’s the flow:

Now let’s call it. For that, we’ll need a new Flow. The same steps apply.

Create the other Flow

Pick the “Run as Child Flow”

Let’s see the result:

Looks good.

There’s another caveat

Sorry but I need to show you the full Flow to mention another caveat. The Child Flow needs to have embedded connections, meaning that you cannot re-use the connections defined, the meaning that you cannot use your Global connections defined in the “Data > Connections.” It’s unfortunate, but I can understand why. The Flow needs to run in a contained context, so all need to be defined in the same Flow. You need to take this into consideration if you want, for example, to send an email in the Child Flow.

Conclusion

Overall this feature is amazing. I will still need to use the old “Request and HTTP Post” solution, but at least now I can gather everything under a “Solution” and have the Flows called much more cleanly.

Have a suggestion of your own or disagree with something I said? Leave a comment or interact on Twitter and be sure to check out other Flow-related articles here.

Photo by Deva Darshan on Unsplash

Manuel Gomes

I have 18 years of experience in automation, project management, and development. In addition to that, I have been writing for this website for over 3 years now, providing readers with valuable insights and information. I hope my expertise allows me to create compelling, informative content that resonates with the audience.

View all posts by Manuel Gomes →

3 thoughts on “Flow: Run a Child Flow

  1. Hi Manuel,
    I need to parse a CSV file and update a SharePoint list with the contents of the CSV, so I downloaded your ‘Parse CSV File’ Flow template. I imported the template, and created a new blank solution, but I cannot figure out how to add your Parse CSV File into the solution. When I look in My Flows, I can see Parse CSV File, but I can’t find it when I try to add an existing flow to my solution, and I don’t seem to be able to use the Run a Child Flow action to call it, which I assume is because I haven’t been able to add it to the solution. What am I missing? I am fairly new to building Power Automate Flows, so I may just be missing a basic step, or has Microsoft changed something? https://docs.microsoft.com/en-us/power-automate/web-api makes it sounds like I won’t be able to add your parse CSV File template because it’s listed in My Flows.

    1. Hi Tom,

      Your reasoning is correct, but, unfortunately, Microsoft doesn’t allow you to import Flows with “Manually trigger a Flow” triggers. I don’t understand why they don’t let this since you can create Flows inside solutions.
      The workaround is to import a complete solution with the “Parse CSV File” inside. You can then reference that Flow from any other solution.
      Can you please try to import this solution (Solutions > Import) and see if it works?

      Cheers
      Manuel

  2. Hi Manuel,

    Question regarding parent and child flow, do the license for both needs to match? For example lets say that you are using a connector that is premium (like Microsoft word) in a child flow, do both the child and parent flow needs the premium license or just the child flow?

    Cheers

Leave a Reply

Your email address will not be published. Required fields are marked *

Mastodon