There is a strange action in Power Automate which is really not there to do anything other than to help you organize the Flow a little better, it seems:
We can use scopes to put other actions in them, so we can, then collapse and expand those scopes this improving the manageability of the Flow:
Is that all there is to it?
Actually, there is more, since there is also a function in Flows which can return inputs and outputs of all the actions which are inside a scoped action:
So, what’s the big deal?
See, it can really help with the error handling. How often would you see an error like this and you wouldn’t know exactly what has happened there?
The reason is obvious in this example – I used incorrect syntax for the Filter. However, what if the Flow becomes much longer and what if I did not know that there is an intentional error in the flow? With the error message above, I might not be able to say a lot about what was the cause of the error.
This is where “result” function comes in.
It’s an interesting function to start with, since it does not show up in the list of available functions (that’s what we call a “hidden gem” )
I can use it:
But there are no hints or “intellisense”:
That does not make it less useful, though, since I can set the Flow like this:
Where my “Set Variable” action would run only if “Scope 1” fails:
With the actions configured as per the screenshots above, here is what will be store in the error variable:
Looking at the output of that “Set Variable” action, I can now see a lot more detailed error message:
And this has all become possible since there was
- A scope action
- A “result” function that can be used with the scoped actions
Those scopes look much more useful now, it seems!
PS. To those who have been working with Power Automate for at least a few years, this may have been known for a while – there is a great post on this topic here: