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.
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.
Then the other important element has been described by John Liu in his post about Tracked Properties a while back.
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.
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.
Configuring the Tracked Properties
To set the tracked properties, go to the Settings option of the action or step.
And then you can specify a property name and an expression that you want to appear within the tracked properties.
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.
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:
Now as we run the flow we will see the following output:
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.