DEV Community

Cover image for 5 Quick Fixes for Power Automate
david wyatt
david wyatt Subscriber

Posted on

5 Quick Fixes for Power Automate

No matter how much I love Power Automate there are always going to be 'niggles'. I'm not talking about big issues, more the ones that you deal with as the impact isn't big enough to impact your delivery, but still big enough that you feel it.

So here are a mix of bugs and poor design decisions that I would love to see fixed.

The Changes
1 Conditions Don't Show Inputs
2 Connection Naming
3 Cancelled Runs Don't Show Logs

The Fixes
4 Switch Copy Paste
5 Expressions, Arrays and Apply to Each


1. Conditions Don't Show Inputs

Every developer must have felt the pain on this one at least once. Your flow doesn't run as expected, you check the logs and the condition returned false instead of the expected true. You look at the inputs and you see this:

condition response

Well gee that's useful, thank you. So now you have to add a compose with a list of the inputs and rerun.

The fix is easy, show the expression with the inputs, or allow an option to show values. This is kind of what I expected 'Tracked Properties' to be instead of the current implementation.

tracked properties

2. Connection Naming

I don't know how, I always try not too, but I always end up with multiple connections for same connection. Why do I need the ability to create multiple, that's a good question.

So when I go to add a connection I end up seeing this:

select connections

And I have no idea which one to pick, which one is being used for what flow.

2 possible fixes, remove the ability to have more then one connection. The only reason to is to enable changing selected flow connections, and that's what connection references are for now. But if you really want to keep them then add the option to change the name in connection settings.

connection name settings

3. Cancelled Loop Runs Don't Show Logs

We have all probably had this happen to use, the flow is looping over hundreds of records, but it fails on the first item. You don't want to wait for the flow to finish (as that will take ages), so you cancel the run. But when you look at the logs you can't see the item that failed.

loop cancelled

I understand why, as the Apply to Each is actually a API call (like Get Items from SharePoint), so the actual looping isn't done in the flow. But that said we get the item detail when complete, so why can't they return the rows that had complete when cancelled.

And that's the fix, update the Apply to Each (and Do until) API's to return items already processed when the flow is cancelled. Or the better approach return each item as it is processed, so we get to see the action in real time as the flow runs 😎

4. Switch Copy Paste

Now this is a niche one I admit, not many people use Switch's, and when they do they may not copy and paste that often. But if you try to you will see that there is a bug, and you can't. You can copy and paste an item from outside into the Switch, and from inside the Switch to outside, but not from inside to inside.

Don't believe me, try it. So now every time I want to duplicate an action between Switch branches I have to paste it outside the scope and drag it in.

The fix is simple, make it work. And I can even tell Microsoft why. When they last updated the schema they didn't update the Switch.

During that update they added a operationMetadataId key to all the actions JSON's (you can see it in the peak code). But when you create a action within a scope that key isn't there.

Outside Switch
code out of scope

Inside Switch
code in scope

5. Expressions and Arrays

To help you Power Automate automatically creates a 'Apply to Each' and adds the action you are editing into it if the input is a item from array. This is a nice touch and definitely stops issues for new developers. The issue I have is this behaviour also happens in the expression editor.

So lets say I want to check if the first item in an array is a value, something like:



if(equals(outputs('Get_items')?['body/value'][0]?['Title'],'David'),'Match','Mismatch')


Enter fullscreen mode Exit fullscreen mode

I type:



if(equals(


Enter fullscreen mode Exit fullscreen mode

and then when I select Title (or any field) it adds the action to a Apply to Each, wipes my expression and replaces it with:



items('For_each')?['Title']


Enter fullscreen mode Exit fullscreen mode

force loop

This is so frustrating, when I'm in the expression editor and have written an expression why does it act like I just selected it in Dynamic Content selector.

And just to add make it even more annoying it then ofen registers the action as has an array item, even when it doesn't. So you can't move it out of the loop.

can't move empty action

The fix again is easy, if I select within the Dynamic Content selector then please do put it in an Apply to Each. But if it's in the Expression editor don't, just leave me in the editor.

Apply to Each
dynamic content

Not Apply to Each
expression


To be fair to the development team they have been pumping out some cool new features (version control, Dataverse run logs), and working on getting the New UI upto speed so I understand why these little niggles are not a priority.

Top comments (9)

Collapse
 
donalmc profile image
donalmc • Edited

Connections name is a real pain. At least with Dataverse, you can set things up to use the one connector (just delete one of them and repoint at the other).
HTTP with Entra is a pain because there are valid reasons for having more than one connector (e.g., one for Graph and another for the local environment) - and it doesn't have the Display Name field.

Image description

Collapse
 
wyattdave profile image
david wyatt

Good shout, forgot about the Entra ones that are specific to a url. Maybe only allow certain ones with different connections

Collapse
 
balagmadhu profile image
Bala Madhusoodhanan

The connection reference is a pain but thanks for the cool tip..

Collapse
 
rob_roach_d2c28fe10ae0410 profile image
Rob Roach

I soooo agree with all! Thanks for posting

Collapse
 
dave_melton_4c69192a3038e profile image
Dave Melton

At last! Someone feels my pain. I've run across every item you mentioned and had to figure unique ways around them.

Collapse
 
linnzawwin profile image
Linn Zaw Win

Can you please elaborate more on the fix for the item 3 "update the Apply to Each (and Do until) API's to return items already processed when the flow is cancelled/return each item as it is processed"?

Kudos for the fix 1. 👏🏻

Collapse
 
wyattdave profile image
david wyatt

When you run tests and you want to cancel mid way through a loop you are unable to see the actions inside the loop. Likewise when watching the flow run live you can't see any loop item until all the items are processed

Collapse
 
linnzawwin profile image
Linn Zaw Win

Thanks, David. I understand the problem now (and I usually face it).
What would be the solution for that?

"to return items already processed when the flow is cancelled. Or the better approach return each item as it is processed"

How to return the item after processing each?

Thread Thread
 
wyattdave profile image
david wyatt

Unfortunately this one requires some help from Microsoft to make changes to Power Automate

Some comments may only be visible to logged-in visitors. Sign in to view all comments.