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.
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.
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.
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.
Power automate split on
If you use Split On then you no longer need the Apply to Each in your 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.