A flow was becoming very big and slow and this generated an undesirable situation, it also interfed with the overall duration of the process. The original flow looped through all the items of a SharePoint list and preformed several actions and manipulations, this look more than a hour. The solution was to created a flow that looped through all the items and a second flow that preformed all the actions and manipulations if required.
During the writing of this blog post there is no default action that can start another flow. But we can start a flow by using the action called HTTP (web service).
Flow being started
First we will need to create the flow that is being started. This is required because we will need the HTTP POST URL of this flow in the flow that starts a Flow. This flow will receive an id and then start on that item.
- Create a flow with the trigger: When a HTTP request is recieved.
- Add the action Parse JSON.
- Add the Get Item (by ID).
- Open the trigger action, the generated HTTP POST URL will be used in the other flow.
- Set the Request Body JSON Schema to be able to receive an id value.
{ "Type": "object", "properties": { "id": { "type": "string" } }, "required": [ "id" ] }
- Set the output of the trigger called body as the content (input) for the Parse JSON action.
- Set the following schema
{ "type": "object", "properties": { "id": { "type": "string" } } }
- Set the action Get Item (by ID) to use the ID generated in the parse JSON action.
- Now you can add all the required actions and manipulations you need to do on the item.
Flow that start a flow
When you start a flow on a item you will need to tell the flow on which item to start. In my example I am using a fixed id. In most cases you will need to created a more dynamic solution.
- Create a flow that starts with your preferred trigger, in my example I used the manual trigger.
- Add the HTTP action to the flow.
- Set the method to POST.
- Set the URI, copy it from the trigger of the flow that is being started.
- Set the Body .
{ "id": "60" }