Troubleshooting in Power Automate

Welcome to post number four in my series on learning Power Automate. The first post covered menus and navigating. Post two introduced triggers and actions. Post three provided the things you need to know for your first build. This post discusses troubleshooting in Power Automate. Read on to learn what to do when your flow isn’t flowing.

Blog or Video

Are you a reader or a watcher? All blog content also exists on my YouTube channel. Please like and subscribe if you learn something!

Analyzing A Current Test

You’ve started building your first flow. It contains a trigger and an action. Now, it’s test time. Will it flow? There’s a saying that 80% of data science is data prep. Similarly, I would argue that 80% of automation work is actually just testing and 20% is building. So, let’s show you how to test and troubleshoot flows in Power Automate.

Testing a Flow

When ready to test, click the Test button in the top right-hand corner of the screen. If you don’t save before going to Test, Power Automate will tell you to Save & Test. Tests only execute after saving.

Triggering a Test

When it comes to testing a flow, how it’s triggered will vary depending upon the type of trigger. Manual triggers are the easiest. You can choose either Manually or Automatically and then click Test or Save & Test.

When using an automated trigger, there are more options. If this is the very first time the flow has been run, you will be forced to select Manually. Automatically will be grayed out.

This means you must manually engage the trigger. In the screenshot below, my flow sends an email when a new message is posted in a Teams channel. The first time I test the flow, I must go to the Teams channel and post a message.

After the first test, I can reuse previous triggers. Power Automate will list triggers available for reuse and tell you if the trigger was successful or not. This may be good information or it might not matter. Reusing triggers saves a whole lot of time and movement between applications.

Troubleshooting a Flow

As it executes, Power Automate will show the success or failure of each step in the flow and how long the action took to execute. The execution time can be handy. If you know a given action usually takes 10 seconds but is now taking 1 second, odds are something is wrong even though the action completes.

Error Details Panel

To get more information, click on the action. When you click, the Error Details panel appears on the right-hand side of the screen. Sometimes the information is helpful. Sometimes it is not, but it is the best starting point. The panel also includes a hyperlink to community posts regarding the error generated. I’ve intentionally not highlighted the How to fix section, as I don’t think I’ve ever fixed an error with the information provided there, but the community link is helpful.

What’s Going In & Coming Out

If Error Details aren’t helpful, take a look at what’s entering and exiting an action. To illustrate, I will run the flow shown above and walk thru each action.

The first action is When new email arrives. In this case, you have to click Show More, Show raw inputs, and Click to download to get more information.

Show raw inputs provide a little bit of information. In the event that your flow was looking for an attachment, this could confirm whether Power Automate was able to find the attachment or not.

Show more information shows mostly the same content as Show raw inputs.

Click to download will open a new browser tab and show you the JSON behind the action. While this might not mean much now, my next example will show how this content can be helpful.

Warning

The JSON might look different depending on which browser you are using. See screenshots below.

Here is the JSON from FireFox.

Here is the JSON from Chrome. Clearly, FireFox is easier to read. I don’t know if there is a Chrome setting that could be changed to make this consumable.

In order to work with email content, which is formatted as HTML, I must convert it to text. I can see the HTML tags coming in from the email, and what comes out is just text without the tags. Thus, this step was a success.

The next action is called newLine. I’m not going to show a screenshot of it because this action is a Compose action that is just a placeholder for a carriage return. I then use the dynamic content from this action in the next step, which is also a Compose action to split lines. Thru the course of writing this post, I realized I didn’t actually need that step, so we’re going to skip over it and look at filterLength.

filterLength is an array filter that removes blank lines. We can see in the inputs that I have blank lines, and the outputs show that I only have blank lines coming out, and my flow failed at the next step, so something is wrong and I need to investigate.

After fixing my flow and rerunning the test, I see blank lines going in and no blank lines going out, which is the desired result.

And, in the next 3 steps, I use expressions to find specific pieces of data in the email. This is one example of the three. I can see the data is found in the email and exits the action.

So, that explains how you can walk thru a flow to see what enters and exits each action. Next, let’s talk about a problem I ran into this week that illustrates how you can troubleshoot dynamic content.

Troubleshooting Dynamic Content

This shows one action in a flow that pulls content from DocuSign. It was working fine until last week. Then, this action started.

Now, under every piece of dynamic content lies a viewable expression. Access it by either hovering over the content or clicking on the content and then hitting Ctrl + C and paste into NotePad.

Get envelope documents action from DocuSign

This is the expression pasted from Notepad.

@{triggerOutputs()?['body/DocuSignEnvelopeInformation/EnvelopeStatus/EnvelopeID']}

So, what this means is that our flow is expecting the receive something called EnvelopID from DocuSign. The content in front of EnvelopID is a hierarchy. EnvelopeID sits at the third level of the hierarchy under DocuSignEnvelopeInforamation and EnvelopStatus.

We investigated the JSON associated with the action (using click to download). As you can see below, in the body of the JSON, envelopeId exists. But, it exists on its own level and is not part of a hierarchy. We know from the expression that envelopeId should live below EnvelopeStatus, which is below, DocuSignEnvelopeInformation. It should be a part of a hierarchy, but for some reason, it’s now on its own level.

In theory, this shouldn’t happen, but it did so we fixed the flow by writing an expression instead of using dynamic content. The screenshot below shows the old expression (from dynamic content) and the new expression.

So, this explains how you can connect dynamic content to the JSON Power Automate provides, which helps clarify what enters and exits a flow.

Troubleshooting Looping Actions

If you are looping or using an Apply to each action, the action will give you the option to move forward or backward to see the details of each piece of information processed.

Next, let’s talk about how to find past test results.

Analyzing Past Tests

Now, what happens if you navigate away from your test results or need to come back to them later? Can you still get back to all that information? Of course, you can! All tests and details live on the main screen as shown here.

Clicking on the date and time will take you to the exact same details as noted above.

Remember!

  1. Start by understanding what’s entering and exiting an action.
  2. Sometimes, the problem is a bug in the software. This isn’t uncommon. If you can’t find an answer reach out to Microsoft support.
  3. You will inevitably run into random or seemingly nonsensical errors and limitations. For example, there is a 256-row limit when pulling data from Excel. Or, in SharePoint, if list has more than 12 columns, you have to create a view and reference the view instead of the list. You build up this knowledge over time.
Angry Chicken GIF by happydog
Angry Chicken GIF by happydog

Google Solves Problems

I couldn’t end this post without noting that Google is your friend. Google the error message. Look it up on Community. Post a question on Community. Modern developers solve problems with Google. And if all else fails, you can try this advice.

Thanks internet

In conclusion, troubleshooting can be frustrating. It can also be incredibly rewarding when you figure out the source of the problem. I’ll be posting more complex troubleshooting in the future. For now, you are prepared to start troubleshooting flows in Power Automate.

Other Content in the Learn Power Automate Series

Leave a Reply

Your email address will not be published. Required fields are marked *

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