Microsoft Power Automate

Debug Compose actions and Conditions in Power Automate

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.

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.

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:

actions('Condition')?['TrackedProperties']

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

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.

Share
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.

View Comments

  • 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

Recent Posts

Create multi user real time apps in Power Apps

When multiple users edit data and you want your app to show real time data,…

2 weeks ago

Sort by Title in your Highlighted Content web part in SharePoint

Yesterday I was asked about how to sort Documents in the Highlighted Content web part…

2 weeks ago

Copy large files from SharePoint to Azure Blob Storage using Power Automate

When you try to copy large files from SharePoint to Azure Bob Storage with Power…

2 weeks ago

Sort an array by dates in Power Automate

When we use the Sort function to sort arrays in Power Automate, it is soo…

3 weeks ago

New! Format data by examples in Power Automate

This feature "Format data by examples" will kill one of my most popular posts! How…

1 month ago

Named formulas in Power Apps using App.Formulas

Do you use the App onstart to set a lot of variables? And then do…

1 month ago
%%footer%%