• Home
  • Blog
  • About Me
  • Home
  • Blog
  • About Me
Logic Apps  ·  Power Automate  ·  Power Platform

Flow – Http Request – Split On Collection

By Joe Gill  Published On 12th June 2019

A use case I like with to use with Flow and Logic Apps is to create a workflow triggered by a Http Request that acts as an API endpoint. In a previous post I explained how to do it and how to configure Flow to the validate the Json payload. In that post the Json request was just a simple contact object with a few data fields that we inserted into Dynamics 365.

Did know you can also create a Flow Http Request to accept an array of Json objects? You can then use the Split On option to fire the workflow for each Json object in a collection like the one below I used in this example.

{
“contacts”: [
{
“contactid”: 1,
“firstname”: “Thelma”,
“lastname”: “Barton”,
“email”: “louis@siegel.mg”
},
{
“contactid”: 2,
“firstname”: “Meredith”,
“lastname”: “O”,
“email”: “marshall@kenney.gl”
},
{
“contactid”: 3,
“firstname”: “Marcus”,
“lastname”: “Gross”,
“email”: “lori@owen.ax”
}]}

Creating Http request Flow

You create your Http request Flow in the usual manner and either use a Json schema or some sample JSON with an array of of objects to generate the endpoint and schema. You can process the collection of received objects by using the “Apply to Each” control to iterate over the collection and execute actions. Below we are looping over the array of contact objects and inserting a record in a database for each one.

Microsoft Flow - Apply To Each
Microsoft Flow – Apply To Each

Examine the Flow run

Having used Postman to call my Flow endpoint with an array of 100 contacts records I can now examine the Flow run. If any of the actions in the loop fail then the run will have failed and you can inspect the run to view individual successes full and failed actions.

power automate collection

Setting for the Http Request trigger

When you use process a collection like this it can be it can makes things hard to manage if you are reprocessing a large number of objects or have long running or complicated workflow. So rather than loop over the objects in your Flow you use the Split On option to split the array of Json objects and fire the workflow for each object. Goto to Setting on the Http Request trigger and turn the Split On option on and enter the name of the array you want to split on.

Microsft Flow - Http Request - Split On

Power automate split on

If you use Split On then you no longer need the Apply to Each in your flow

Microsoft Flow - Split On Flow

Collection of objects they are spilt into individual flow runs

Now when I submit the collection of objects they are spilt into individual flow runs that I can view and resubmit as required.

Microsoft Flow - Split On Runs

Generate Dynamics 365 PDF with Power Automate
Previous Article
Build a Bot with Power Virtual Agents, Flow and CDS
Next Article