Power Automate: Ignore or Handle Errors with Run After Settings

In general, a Power Automate flow will stop whenever it finds an error. The default behavior of an action is to execute only if the previous step is successful, which can be a problem for those scenarios where occasional errors are already expected.

When designing your flows in Power Automate, the automation will start at the top, with a manual, scheduled or automated trigger, and linearly proceeds through each action until it reaches the final step, as represented in the blue arrow:

table name in compose action in power automate

If there are no errors across these steps, your flow will complete successfully. However, if something unexpected happens in the one of the actions, the flow will immediately stop and not execute (skip) all the later actions. For example, in the image above we’re referencing an invalid value in the dynamic content used for the Table input, in the List rows present in a table action (highlighted in red above).

If we run this flow, all steps until the Compose – Table name will execute successfully (highlighted in green below), while the List rows present in a table action will fail (in blue) and the Apply to each will not even be executed (in orange):

different statuses for actions in in power automate run

In some scenarios, however, we might expect to handle the error from List rows present in a table action, or at least log it somewhere, such as in a Dataverse table. In some other cases, we could even expect the flow to simply continue to run linearly, ignoring the error in any earlier action.

This is the type of customization that a Run after configuration can provide. By using the Run after, we can either branch our flow to different paths when an error is found, or ignore it and move forward to the following steps.

Configuring the Run after in Power Automate

To set up the Run after, you can simply select the action that you want to change the behavior (the one that should run even if the previous step isn’t successful) and go to the Settings tab (in green). There you will find the Run after customization group, showing the name of the previous step – which in this case is the List rows present in a table, since we’re configuring it for Apply to each. After expanding this action, you will see different checkboxes of behaviors for this List rows present in a table action, with Is successful selected by default (in red):

configuring run after in power automate

Each checkbox represents a possible outcome from List rows present in a table, and their names are self-explanatory on what each of the options represent.  For example, if we select the Has failed checkbox, the Apply to each will “run after the List rows present in a table action has failed”.

Those are the execution scenarios for each of the checkboxes:

  • Is successful: Default scenario. The action will run only if the previous step completes successfully without any errors.
  • Has timed out: The action will run if the previous step receives a timeout, it means, exceeds its allowed execution time and stops without completing.
  • Is skipped: The action will run if the previous step was skipped, usually because a condition was not met.
  • Has failed: The action will run if the previous step failed due to an error.

Once you select any of these checkboxes (it supports multiple outcomes), you may notice some small icons on the top of the action that you’re configuring. For example, after selecting the Has timed out and Is successful (in red), you will see small icons on top of the Apply to each (in green), meaning this step will run if List rows present in a table either succeeds or times out. Since we didn’t customize the Run after for the other actions in this flow, they won’t display any icons (in blue):

small icons corresponding to run after

Branching your flow based on an error

One of the main scenarios for the Run after configuration is to handle errors or at least to direct the flow to different paths depending on the outcome of a step. This works similarly to a Condition, but instead of adding a new action, you simply add a new parallel branch to the flow. To do this, right-click the Add step and select Add a parallel branch (in red):

parallel branch in power automate

For this example, we added a Post message in a chat or channel action after the List rows present in a table, and configured its Run after to Has failed only, which adds a small red icon on the top of the action (highlighted in yellow). We’re also adjusting the Apply to each to run only if the previous step is successful (in blue):

error handling in power automate

Once we check any option different form Is successful in the Run after setting, Power Automate will represent the connection between current action and the previous one with a dashed line, as you can see for the line between the Excel and the Teams actions (highlighted in green above). This indicates that the action will be executed in a non-default scenario (time out, skip or failure of the previous step).

After running the flow again, the Excel action will fail as expected (in blue) and consequently the flow was branched to the Teams action, which was successfully executed (in green). Meanwhile, the Apply to each was skipped (in orange), as it was configured to run only if the List rows present in a table was successful:

testing error handling in flow

And consequently, a message is posted to a Teams Channel:

error notification in teams

Ignoring errors in Power Automate flow actions

Another possibility is to execute a step regardless of the success of the previous action. For that, we can simply check all options under Run after, which consequently will add the respective icons to the top of the configured action. In the example below, we are using this configuration into Apply to each (in red), and this loop contains a single Compose inside, which will simply display “Issue + random number” (in blue), where the number is randomly defined between 0 and 100 using an expression:

ignoring errors in power automate

Another customization was to include a coalesce expression as input to the Apply to each, which allows you to define a fallback sequence of values to be used if the primary input is null or invalid. Originally, the flow would try to loop all records from the Excel table, but since the List rows present in a table will retrieve an error, coalesce provides an alternative value for this scenario, which in this case is a list of numbers from 1 to 10, created with the range expression (in red):

coalesce expression

After running the flow, both branches will be executed, since there was an error in the List rows present in a table action. Because of coalesce expression, the Apply to each runs successfully, ignoring the error from the previous step:

apply to each ignoring errors in flow

Conclusion

In this blog, we saw how to use the Run after configuration, which can be very helpful to handle errors in Power Automate. Let us know what do you think about this blog in the comment section, and don’t forget to check our website, our YouTube Channel or connect on LinkedIn!

By Raphael Zaneti

Power Platform Developer