Azure Logic App | Parallel Terminates & Action State Checking

Posted by Andrew Wilson on Sunday, September 4, 2022

Problem Space:

I have recently encountered an interesting problem space with Azure logic app action run after logic. I ran into the problem whilst creating a logic app that will perform actions in parallel. The bulk of the actions are performed in scopes. If an action fails within the first set of scopes, the scope status is Failed. If the first scope fails, then the second scope full of actions are executed (this based on run after logic). The problem with this is that I still need the logic app to terminate as Failed so that an alert will be fired off.

Assumed fix one

To fix this, I assumed that I could place a terminate action after the parallel actions conclude with run after logic Succeeded. Thus being, if the second scope on either branch has succeeded, then the terminate failed action runs.

This logic can be seen in the diagram shown below:

Initial Design

How this actually turns out is that both parallel first scopes will have to have failed and the second scopes have run for the terminate condition to run. Thus, if using run after logic to assess if an action after a parallel stream should run will only work in an AND logic case.


Both second scopes have succeeded, or both second scopes have failed etc.

Not if scope 2.2 succeeded or if scope 3.2 succeeded.

Assumed fix two

After validating the run after logic of the first assumed fix, I then experimented with placing a terminate failed action at the end of each parallel stream with the same run after condition. As you would expect, the major problem with this is that if the one parallel stream fails first, the other stream will be skipped mid execution. Clearly not fixing the problem. This can be seen in the diagram below:

Assumed Fix Two

Actual Fix

The actual fix for this is not one you would naturally come to. Based on Microsoft Documentation we need to evaluate the scopes result status within a conditional action, then conduct the actions based on that result. Within the condition action, we can use either and/or logic as required. The expression to retrieve the scopes run status is as follows:


This solution allows us to retrieve individual scope run status and evaluate at the end of the parallel stream. Based on either 2.1 or 3.1 scopes failing, we can then run our failed termination, else allow logic app to succeed.

Bear in mind that for this to work, the conditional after the parallel stream needs to have all run after types set so that the conditional runs regardless. This can be seen in the diagram below:

Actual Fix