Debug compose actions and compose actions

Debug compose actions and condition steps can be difficult as flow runs will only show the output of your expressions. In this post a workaround, to make this easier.

Debug Compose actions and Conditions in Power Automate Microsoft Power Automate Debug compose actions and conditions

Try-Catch-Finally

Before I go into the solution, it will be useful to reintroduce the Try Catch Finally pattern used within this post. It has been a while since I wrote my first Try catch pattern post, 4 year ago, and since then it has been accepted as general best practice within the Power Platform community.

Tracked Properties

Then the other important element has been described by John Liu in his post about Tracked Properties a while back.

Example flow

In this post I created an example flow that doesn’t do much. Just a condition and some compose actions. The flow itself is less than useful, however the pattern described can help a lot when you want to debug compose actions or condition steps.

Debug Compose actions and Conditions in Power Automate Microsoft Power Automate Flow with expressions in compose and conditions

Using the Try Catch Finally pattern , I’m going to collect my debug information in the finally scope. The finally scope will always run, no matter if my flow is successful or if it fails half way through.

Debug Compose actions and Conditions in Power Automate

Configuring the Tracked Properties

To set the tracked properties, go to the Settings option of the action or step.

Debug Compose actions and Conditions in Power Automate Microsoft Power Automate Settings on the condition

And then you can specify a property name and an expression that you want to appear within the tracked properties.

Debug Compose actions and Conditions in Power Automate Microsoft Power Automate Creating a Tracked property

So typically for a condition you could include all parts of the expressions as specified within your condition.

Similarly we can also set the tracked properties of the compose actions.

Debug Compose actions and Conditions in Power Automate Microsoft Power Automate Tracked property on Compose

Creating the Finally block

Now that the tracked properties have been configured, we will need a compose action in our Finally scope. In this Finally scope we can add all the Track Properties from our steps inside the flow. With just a simple expression:

actions('Condition')?['TrackedProperties']
Debug Compose actions and Conditions in Power Automate Microsoft Power Automate actions function to get the tracked properties

Now as we run the flow we will see the following output:

Debug Compose actions and Conditions in Power Automate Microsoft Power Automate image 3

Benefits

The approach described in this post has some benefits. Traditionally, I would probably just add another compose action above each condition. however all these compose actions clutter my flow and makes it harder to read the flow when all works as expected. With this approach all my debugging information is displayed at the end of the flow, nicely together in one box.

The user interface of tracked properties could probably do with some improvements, maybe one day it will be made easier to enter the expressions. But as we are only copying expressions entered in actions it shouldn’t be too difficult.

Avatar for Pieter Veenstra

By Pieter Veenstra

Business Applications and Office Apps & Services Microsoft MVP working as a Microsoft Productivity Principal Consultant at HybrIT Services. You can contact me using contact@veenstra.me.uk.

2 thoughts on “Debug Compose actions and Conditions in Power Automate”
  1. Thanks for the update! Very interesting use of the tracked properties. It does seem development of Logic Apps/Automate is going quite slow…
    I actually have a question…
    What is your approach to dealing with For Each loops where you want track failed iterations? Both from a debugging perspective and an error handling perspective I have not find a good approach yet. Thanks

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.