Create or join parallel branches with workflow actions in Azure Logic Apps

Applies to: Azure Logic Apps (Consumption + Standard)

By default, your actions in a logic app workflow run sequentially. To organize actions into separate branches and run those branches at the same time, you can create parallel branches, and then join those branches later in your workflow.

This guide shows how to create parallel branches in a workflow and rejoin those branches, as shown in this high-level diagram:

Screenshot shows high-level conceptual diagram with parallel branches that later join in workflow.

Tip

If your workflow trigger receives an array, and you want to run a workflow instance instance for each item in the array, rather than create parallel branches, you can debatch that array instead by using the SplitOn trigger property.

Prerequisites

  • An Azure subscription. If you don't have a subscription, sign up for a free Azure account.

  • A logic app workflow that starts with a trigger and the actions that you want. Make sure that your workflow includes the actions between where you want to add a parallel branch.

Considerations for working with parallel branches

  • A parallel branch runs only when its runAfter property value matches the parent action's completed status. For example, both the branches starting with branchAction1 and branchAction2 run only when parentAction completes with Succeeded status.

  • Your workflow waits for all parallel branches at the same level to complete before running the action that joins these branches.

Add a parallel branch action

  1. In the Azure portal, open your Standard logic app and workflow in the designer.

  2. Between the actions where you want to add a parallel branch, move your pointer over the connecting arrow.

  3. Select the plus sign (+) that appears, and then select Add a parallel branch.

    Screenshot shows Standard workflow with selected plus sign and selected option, Add a parallel branch.

  4. Now, add the action that you want to run in the parallel branch. In the Add an action pane and search box, find and select the action that you want.

    Screenshot shows Standard workflow with search box named Choose an operation.

    The selected action now appears in the parallel branch, for example:

    Screenshot shows Standard workflow, parallel branch, and previously selected action.

  5. To add another action to the parallel branch, under the action where you want to add a new action, select the plus (+) sign, and then select Add an action.

    Screenshot shows Standard workflow and how to add another action to the same parallel branch.

  6. In the Choose an operation search box, find and select the action that you want.

    Your selected action now appears within the current branch, for example:

    Screenshot shows Standard workflow with added sequential action.

To merge branches back together, join your parallel branches.

Parallel branch definition (JSON)

If you're working in code view, you can define the parallel structure in your logic app workflow's JSON definition instead, for example:

{
  "triggers": {
    "myTrigger": {}
  },
  "actions": {
    "parentAction": {
      "type": "<action-type>",
      "inputs": {},
      "runAfter": {}
    },
    "branchAction1": {
      "type": "<action-type>",
      "inputs": {},
      "runAfter": {
        "parentAction": [
          "Succeeded"
        ]
      }
    },
    "branchAction2": {
      "type": "<action-type>",
      "inputs": {},
      "runAfter": {
        "parentAction": [
          "Succeeded"
        ]
      }
    }
  },
  "outputs": {}
}

Join parallel branches

To merge parallel branches together, under all the branches, just add another action. This action runs only after all the preceding parallel branches finish running.

  1. In the Azure portal, open your Standard logic app and workflow with the parallel branches that you want to join in the designer.

  2. Under any of the parallel branches that you want to join, select the plus sign (+), and then select Add an action.

    Screenshot shows Standard workflow with selected plus sign.

  3. In the Add an action pane and search box, find and select the action you want to use for joining the branches.

    Screenshot shows Standard workflow, search box named Choose an operation, and available actions for joining parallel branches.

  4. On the designer, select the previously added action. After the action's information pane opens, select Settings.

  5. On the Settings pane, under Run After, open the Select Actions list, and select the last action in each branch that must finish before the join action runs.

    You're effectively specifying that the join action runs only after all the selected actions finish running.

    Screenshot shows Standard workflow, the action that joins preceding parallel branches, and selected actions to first finish running.

    When you finish, the selected action now appears under the parallel branches that you want to join, for example:

    Screenshot shows Standard workflow with the action that joins the preceding parallel branches.

Join definition (JSON)

If you're working in code view, you can define the join action in your logic app workflow's JSON definition instead, for example:

{
  "triggers": {
    "myTrigger": { }
  },
  "actions": {
    "parentAction": {
      "type": "<action-type>",
      "inputs": { },
      "runAfter": {}
    },
    "branchAction1": {
      "type": "<action-type>",
      "inputs": { },
      "runAfter": {
        "parentAction": [
          "Succeeded"
        ]
      }
    },
    "branchAction2": {
      "type": "<action-type>",
      "inputs": { },
      "runAfter": {
        "parentAction": [
          "Succeeded"
        ]
      }
    },
    "joinAction": {
      "type": "<action-type>",
      "inputs": { },
      "runAfter": {
        "branchAction1": [
          "Succeeded"
        ],
        "branchAction2": [
          "Succeeded"
        ]
      }
    }
  },
  "outputs": {}
}

Next steps