Flow: Start a flow with another flow

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" } 
Share

6 Replies to “Flow: Start a flow with another flow”

  1. I cannot seem to get this to work. I copy and pasted the JSON schemas you provided but neither the trigger or the parse action are available in the get item action id dynamic content options

  2. Hi Anthony,

    sorry to hear it does not work for you. Maybe if you provide some additional information I might be able to help.

  3. Great Post. Just getting into passing along flows between each other. I am having an issue with getting this to work. When trying to select a specific ID my output looks like this:

    ID is {“id”:”49″} instead of the actual ID, 49.

    Which is follow by a flow error of Get Item Failed – item not found.

    HTTP Post Body:
    {
    “id”: “49”
    }

    HTTP Request Body:

    {
    “Type”: “object”,
    “properties”: {
    “id”: {
    “type”: “string”
    }
    },
    “required”: [
    “id”
    ]
    }

    Parse:
    Content “Body”
    Schema:
    {
    “properties”: {
    “id”: {
    “type”: “string”
    }
    },
    “type”: “object”
    }

    Get Item
    ID: “Body”

    Any help would be great. Thanks

    1. Flow reminds us to define the Content-Type header as application/json: “Remember to include a Content-Type header set to application/json in your request.” – perhaps this is what’s missing?

Leave a Reply

Your email address will not be published. Required fields are marked *