The Advanced Expressions for MS Flow session, led by Stephen Siciliano, was chock-full of information on the various types of advanced expressions available in MS Flow, suggested uses for these different types, and real-world demos. Using advanced expressions can seriously kick up your MS Flow game, so I highly recommend becoming familiar with these gems.
Advanced expressions are function expressions that can be written in a compose action or inline in a conditional. When an advanced expression is written in a compose action, the result of the expression can then be used in other areas of your flow. On the other hand, if the expression is written in a conditional, the result of the expression will be used to determine to which path the flow will continue. In this case, the expression must begin with the @ character, and the expressions that can be used here include equals(), and(), or(), not(), less(), lessOrEquals(), greater(), and greaterOrEquals().
However, I may be getting ahead of myself. You may still be asking “Where do I find advanced expressions?” So, let me start there. Once you create an action, click on “Add dynamic content”, in the pop up, there are tabs for “Dynamic content” and “Expression”. Click on “Expression”. All of the advanced expressions are listed by type. They also include a short snippet description to assist you in determining what they do and how you might use them. It helps that most of their names are fairly descriptive as well.
The beauty of advanced expressions is they give you many more options for working with your data; and therefore, you can create flows that can do more for you. With advanced expressions you have the power to manipulate and generate data in the following ways:
Converting Data Types
Working with Strings
The if() expression can be helpful if you are simply trying to add styling or set a value based on a condition. You can write a simple if() expression rather than add an additional layer of conditions into the flow. Multiple layers of nested conditions can become confusing and can get short circuited if a missing property gets referenced.
Properties that are not set or return as null will cause your flow to fail. To avoid this, use the coalesce() function in conjunction with the ? character. The idea is to set a default value for the property that will be used if the property returns as null. This looks something like this: coalesce(body(‘Get_record’)?[‘content’], ‘Default Value’).
There are also some really cool advanced expressions for working with lists/arrays, and workflows. I encourage you to poke around in the Expression tab to see what else is available. In the session, Siciliano also briefly discussed asynchronous actions (using 2 triggers in the same flow), working with other flows (using the Flow Management Connector), and calling nested workflows (use this to break up larger flows into smaller chunks). As I stated earlier, this session was chock-full of information. It was well worth the time spent. I’d like to think my Flow game has been kicked up a notch as a result.