May 12, 2020

How to Call a Child flow from the Parent flow – Part Two

Introduction
In this article, we will see how we can create a Child Flow which is triggered from the Parent Flow. In the earlier blog, we discussed the business requirements and created a Parent Flow.

Now, let’s create a child flow in the same solution where we have created our Parent Flow.

Step 1: Add HTTP Trigger Action. From action select, "When a HTTP request is received".

We need to add Request Body JSON. Click on Generate from sample showing in the above screenshot. This will open below modal. We need to add sample JSON data to generate JSON Body. Add below JSON and click Done.

 {"Name" : "XYZ", "Experience" : 1, "Salary" : 20000, "Pay Scale" : 0.02, "ID" : 1 }  


So, here we need Name, Experience, Salary, Pay Scale and ID columns from Parent flow.

Step 2: Now, we need to multiply Salary with the Pay Scale. Add Compose Action and write logic to multiply Salary and with Pay Scale.

 mul(triggerBody()?['Salary'], triggerBody()?['Pay Scale'])  


Step 3: Now, add an action to update the item. Here in the Pay Scale Result field, we are passing the output of compose action method.
We also need to make sure that Is Trigger value is set to "No" otherwise the parent flow will continue running in infinity.

Step 4: After Update item action add “Respond to a PowerApp or Flow” action. Add this action to parallel branch.

In Success Action (left side action in above step), click ellipses and click "Configure run after" as shown in below screenshot.

Select "is successful" checkbox and click on done.

Same way, let’s configure the failure action. In Failure action set below options.

So, our child flow has been created successfully.

The above flow will return the variable to the Parent flow.

Conclusion: This is how, we can trigger child flow from the parent flow.

If you have any questions you can reach out our SharePoint Consulting team here.

No comments:

Post a Comment