Wednesday, November 13, 2019

Getting Started with Child flows in Power Automate


Child flows are new to Power Automate, and although the concept is simple, getting started is a little tricky.  I'll walk you through setting up parent/child flows within a solution and how to move data between the two.

Use a Solution

The first roadblock you might run into is that Child flows must be used inside Solutions.  What is a solution, you say? Well first, you'll find them on the left rail in Power Automate.  Second, solutions are a great way to package up one or more flows for deploying to a production environment.  This means that you don't have to export and import individual flows one at a time; instead, you export and import one solution package. (Want more?  Here's the Microsoft Walkthrough!)

To create a solution, click Solutions and then click + New solution.  Fill out the new solution form in the right rail and click Create.  

The flows

Your instinct might be to create the parent flow first, and that's fine if you have some logic you know you need to implement there first.  However, you cannot add the Run Child Flow action and save your flow without an existing child flow to point to.  For our purposes here let's create the child flow first.  Click the + New drop down in the top toolbar and select Flow.



The trigger for the child flow can be a manual button, but I prefer to use HTTP actions for my trigger and for my response.  I find this to be more flexible, and frankly, this is my comfort zone!  

Let's also add the Get items SharePoint action so that we have some data to send back to the parent flow.  I'm going to limit the count to the first item for the sake of simplicity.  

Now let's add the HTTP Response action as the last part of our child flow.  Here, set the Status Code to 200 to indicate a successful response.  In the Body of the response, add the Body from the previous Get items action.  This will serve the SharePoint items back to the parent flow, making them available for us to use.  Here's our simple child flow in its entirety: 


Make sure you rename your flow and save it.  Now let's work on the parent flow!  

Navigate back to the solution you created.  You may notice that multiple tabs open as you work on flows within a solution.  It's alright to close the extra tabs, but just know that your solution view will be updated with your changes after you save them and click the "done" button in the dialog that pops up.  

Add a new flow from the top toolbar as before.  I'm using a recurrence trigger here, but you can also use a manual trigger.  Add the Run a Child Flow action next, and choose your child flow from the drop-down.  You'll notice that the only choices available are flows within the current solution.  


We aren't finished, but this is a good spot to save the parent flow and do a test run.  What we want is the body of the response coming from the child flow because we are going to use that in a Parse JSON action next.  After your successful test run, go to the child flow inside your solution and click into the most recent run instance.  From there, copy the Body from the Response action.



Navigate back to your parent flow.  Add the Parse JSON action, with the Content being the Body from the Run a Child Flow action.  Click on use a sample payload to generate schema and paste in the response body from the child flow:


Next, let's send an email with some of the information from the child flow.  Add the Office 365 Outlook Send an email action.  For the subject, search within the Dynamic content window for Title.  Add the Title column from the previous Parse JSON action.  Notice that Power Automate will add an Apply to each container for you since it does not know how many items have been returned from the response body, only what columns and data types are being returned.


Save your flow and run a test.  You should receive an email--or emails!-- based on the Get Items action buried in the child flow.  There are a lot of possibilities here, and I'm looking forward to seeing what interesting solutions are out there!



Photo by Sergey Pesterev on Unsplash

11 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. This comment has been removed by the author.

    ReplyDelete
  3. Nice post Ashley! In a recent project I used a child flow to remove invalid characters from a variable before using it to create a SharePoint folder needed by CRM. I was going blog about it but this post covers it, so I will just past yours along. Keep up the great work!

    ReplyDelete
  4. This comment has been removed by a blog administrator.

    ReplyDelete
  5. This comment has been removed by a blog administrator.

    ReplyDelete
  6. Thank you, this has been very useful! A question can you pass values through to the child flow, if possible how?

    ReplyDelete
  7. This comment has been removed by a blog administrator.

    ReplyDelete
  8. By and large, an unwed dad can't win care from the mother if the mother is fit to bring up the kid, yet he might have the option to acquire need over different family members, non-permanent parents or expected new parents. David Iancu

    ReplyDelete
  9. This article investigates practices related with the psycho-psychological mistreatment of a child; the signs and side effects a child and grown-up survivor may display because of this specific type of misuse; and proposals in regards to potential pathways of recuperating. teen programs

    ReplyDelete
  10. Thanks for Great Article, for sharing content and such nice information for me. I hope you will share some more content iso45001 lead auditing course in Pakistan . Please keep sharing!

    ReplyDelete
  11. Hi there,

    Thank you so much for the post you do and also I like your post, are you looking for Buy genuine documents online in the whole USA? We are providing Buy Quality Documents Online,
    Buy Documents online, Buy genuine passport online, Buy Genuine Driving License online, Buy Real and Fake ID card Online, Buy original Ielts certificate without exam, Buy SSD Chemical Solution Online, Buy Counterfeit Bank Notes Online, Buy Activation Powder Online, Activated powder buy online,
    buy documents online, buy fake documents online, buy documents online, buy fake documents online, buy real documents online, buy genuine documents online, real fake documents, fake documents website, buy fake documents, genuine documents online, fake and real documents for sale, Buy documents online, Buy fake documents online, in the world with the well price and our services are very fast.

    Click here href=" https://www.swiftdocumentsonline.com/about-us/"> title=”Buy genuine documents online | Buy Quality Documents Online for sale”


    MORE DETAILS......
    Contact us at: +33605696710+15078810466
    Email: infoswiftdocuments@gmail.com

    ReplyDelete