7 Power Automate Flow Tips and 7 Reasons Why Flow is Annoying
7 Power Automate Flow Tips
Here are some notes from a recent project - drink it in.
-
TIP 1 - Save often to catch errors early. An “Apply to each” block can have an error nested deep making it hard to determine where the error is, giving just “The input parameter(s) of operation ‘Apply_to_each’ contains invalid expression(s). Fix invalid expression(s) for the input parameter(s) of operation ‘Apply_to_each’.”
-
Referencing Results of SharePoint Get files (properties only) Action
- TIP 2 - To reference a column within SharePoint - Get files (properties only), for example for a column named “PurgeDate”, use
item()?['PurgeDate']
. - TIP 3 - To reference an item’s path, you need braces, .e.g,
item()?['{FullPath}']
. The braces are needed for returned computed objects which are not actual metadata. - TIP 4 - To determine how many path segments (folders) there are to your item, count the slashes with the length() function:
length(split(item()?['{FullPath}'],'/'))"
. A value of 2 is top-level; 3 is a subfolder, etc.
- TIP 2 - To reference a column within SharePoint - Get files (properties only), for example for a column named “PurgeDate”, use
-
ODATA filters can be a big help in your SharePoint Get Files action.
- TIP 5 - The ODATA
contains
function does not work in Power Automate, butsubstringof
does. So instead ofcontains(FileLeafRef, 'AndyTest')
, usesubstringof ('AndyTest', FileLeafRef)
in the filter parameter. - TIP 6 - Despite using the uppercase
OR
in its tooltip, this is invalid syntax. Use lowercase. This query returns only folders containing “AndyTest” within its name, reducing my runtime from 15 minutes to under a second and running only on my test folders, not production folders:
- TIP 5 - The ODATA
-
TIP 7 - Sometimes “this contains invalid expression(s)” error is just Power Automate being whimsical and finicky. Deleting and recreating the offending action may resolve it. This is one reason I feel that Power Automate is a substandard development platform, worse than BASIC on MS DOS. Take that Microsoft.
7 Ways Power Automate Flow Could Better
I’ll admit up front that my experiences with “no code” and “low code” are mostly frustrating especially if you need to do anything interesting (read “complicated”). That said, often Power Automate Flows require the least effort for the entire life cycle of a project relative to other development platforms such as SharePoint Framework, Azure Functions, etc.
- Quit it with the invalid expression when it is valid. There should be a way for it to clear itself and sort it out.
- Show me the actual action that is not letting me save my Flow, not rolled up to its great-great-great-grandparent.
- It would be nice to be able to edit the JSON directly in Code View. If I have a syntax error, fine, don’t let me save. But being able to copy paste from other actions and Flows would save me so much time. Note that if you really, really need to edit the JSON, you can export your flow, unzip, edit the JSON, rezip and reimport. The details are beyond the scope of this post.
- I don’t think there is a good way to indicate where Copilot should add an action. If you have multiple places where you can add actions due to dead-end if statements, it just picks one.
- Renaming actions enables a bit of documentation for easier maintenance, but there is no obvious way to determine what the action is after you have renamed it. This should be in the “About” tab of the action. For example, I renamed a SharePoint
Get files (properties only)
Action to “GetAllFolders”, but there is no way to determine the original name of the action as the operationId in Code View is different. - The new Flow designer has its merits but is still missing functionality. I’m numb to Microsoft removing features as they move to new, “modern” feature sets which has less and less of some of the richer features that improve productivity. This has been going on for decades, something I first noticed in the Office suite in the 1990’s when they dumbed down the interface, I suppose to make the initial learning curve less steep.
- Gracefully handling errors during runtime seems more complicated than it needs to be and feels kludgy, but that is similar to how a lot of how Power Automate is.
This was cathartic. Hope you enjoyed the 7 & 7. Cheers!