In this post, let us see how to implement "Nested Flows" in Power Automate.
Some use cases:
- To create a common logic and make use of "Run a Child Flow" action
- To perform actions on the database without providing access to the end users.
Let us create records in SharePoint (using Student Name and Email fields in this post) without providing access to the end users using nested flow concept.
- Parent Flow (which triggers the child flow)
- Child Flow (nested Flow)
Go to flow.microsoft.com, log in and select respective environment from the drop-down.
- Click on "+ Create"
- Choose "Instant flow"
- Provide a name and choose "When an HTTP request is received" and "Create"
- Now, we need to provide inputs to the flow (inputs from the Parent Flow)
- We need to generate Schema for "When an HTTP request is received" trigger
- Click on "Use sample payload to generate schema" and upload he schema
"Student Name":"Power Assist",
"Email": "PowerAssist2020@gmail.com"
}
- Next step is to add respective actions, in our case it is "Create Item" in SharePoint.
- Click on "+ New step" and add "Create Item"
- Select respective "SharePoint Site" and "List" details from the drop-downs
- Once the list selected, related fields in the list would get populated.
- Go to the required fields, and choose dynamics content and add the values from the "Trigger Body"
- Now, let us add one more action to send response from Child Flow to Parent Flow
- So, for that add - "Response" action
- Under "Body" - add dynamic content from "create item" action
Now, save the flow and create another flow [Parent to call this].
- Once the "Child Flow" is saved, you would have observed a new URL generated for the Child Flow's trigger "When an HTTP request received".
- Copy the URL and keep it handy, we are going to use it in Parent flow
- Click on "+ Create" to create Parent Flow and Select "Instant Flow" [you can chose the required trigger]
- I am adding two input values to create items in SharePoint. [Student Name and Email]
- Now add "HTTP Request" action and provide the details
- Method : "POST"
- URI: "Child Flow Trigger URL"
- Body: "the values (inputs) to be sent to child flow
- Add "Response" action next to "HTTP" to capture the outcome from the Child Flow, as we have added in Child Flow
Advantages:
In the Child Flow, configure the actions with required account. So, all the records
would get created with that account, even the user doesn't have access to the Data
Source.
Comments
Post a Comment