Search
  • kriSHna

Create nested flows in power automate (Parent - child flows)

In this blog post, we will learn the creation of nested flows in PowerAutomate this approach is helpful when we would like to call other flow to do operation using an HTTP trigger.


You can also make use of this approach when you would like to send email from power apps using power automate and want to use the SendAs field in the office365 action card.


When you implement all the actions in a single flow for sending email and then connect it to power apps, it might break and result in errors, utilize this approach to avoid errors.


In this post I am trying to show how to pass parameters between two different flows and evaluate the data, you can use the same approach and modify steps for power apps.


Create child flow


Step 1: Open flow page, and click on create, select automated from blank option and click on skip button this will take you to flow, editor, where you can create flows.


Step 2: Firstly, we will create the child flow as we have to insert the URL coming from the child flow into the parent flow.


In the trigger step, search for HTTP request trigger "When a HTTP request is received" and add it to the designer, after adding this step it will a blank rectangular area where you can specify request body and parameters to be extracted from the request.

Click on "Use sample payload to generate schema" here we will configure the elements. For this, you might require little knowledge related to JSON even if you don't have that's ok.


You must always have to enclose information being entered here in {} and also you have to specify the parameter name and parameter value in "" (double quotes). If you are trying to enter a numeric value then ""(double quotes) are not required.


Sample code for extracting numeric parameter values from the request is as follows

{
    "num1":12,
    "num2":13
}

As shared above, I have enclosed the data in angular brackets and the parameter values in double-quotes. Value that we enter here is for reference purposes and will not have any impact on original information.


Once the above information has been updated, click on submit and you will be able to see schema properties


Step 3: After configuring the trigger step you can add any steps based on how you want to consume the information, I am adding a compose action to display the values that have been captured.

Step 4: Once all the steps have been configured, save the flow. After saving the flow you will be able to see that a URL will be generated on the trigger step, copy the URL, and keep handy.


Creating Parent Flow.


Now we will create the parent flow which will pass the information to the child flow for evaluation and consumption.


Step 1: Open flow home page and click on create, Select manual flow and manual trigger. After the selection click on create to get navigated to flow editor.

Step 2: Add input actions to the trigger, I have added two numerical inputs as defined in my child flow


Step 3: Add HTTP action to send a request to child flow and share information. Select the method post and paste the URL that is copied from the child flow.


In the body, we will define the parameters that have to be passed to child flow in a record/JSON format.

Ensure that you are following the format shared before where you are enclosing all information within angular { brackets and parameter information inside " quotes.


The sample request will look as follows.


Voila, we are done now we have both the flows set up and are ready to kick-off. Click on the test to check if the flow is working fine or not. Enter data in the numerical input fields and check if the information is being passed to child flow and you are able to see the same data in the child flow.


The approach is also useful when performing complex actions where you cannot have all the implementation in a single flow.


#msflow #PowerAutomate #HTTPRequest #nestedflow