7 one line expressions that could help you in Microsoft Flow

Have you ever wondered why the Expression box in Microsoft Flow is so small? It is because Flow is a low code product and low code means that we don’t need much code. Often a one liner can do the job.Small expression box

Sometimes it is the small things in Microsoft Flow that make it difficult to get the job done! In this post I’m looking at 10 one-line expressions that can help. Most of these on liners will fit in that small expression box.

Expression 1 – Get your workflow run URL

This is one of my favourites that couldn’t miss from this list.


For more details see my post about finding your run Url.

Expression 2 – Format your dates

Formatting dates is easy in Flow

formatDateTime(utcNow(), 'yyyy-MM-dd')

Also see How to find your overdue tasks?

Expression 3 – Get the last X characters from a text

Getting the first X characters is easy using the substring function. The last X characters is slightly harder especially if you don’t know how long the text is. The following expression is your answer:

substring(outputs('Compose'), sub(length(outputs('Compose')), 4),4)

Last 4 characters

Expression 4 – Get that space into a variable

When you set a variable to a space Flow will tell you that the value is empty. the following expression will help you set a variable to a space.

replace("X","X"," ")

Expression 5 – Fix those failing switches

When you use switches in Flow and the switch value is sometimes not set you will find that your flow will fail. If you use the coalesce function you can make sure that you always get a value from a variable or action output. Even if the variable or output isn’t set.


For more information see Improve your switches.

Expression 6 – Compare those texts

How often do you need to check the value of a text variable or output. A while back I was looking at the extensions of a file name

The below expression returned false:

equals('Pdf', 'PDF')

In the above example I used variables, but for simplicity sake I’m using hard coded strings. To solve my problems I used the toUpper fuction:

equals(toUpper('Pdf'), toUpper('PDF'))

Expression 7 – Have you got any great expressions?

The last expression spot in this post is still available. Have you used any great expressions? Please leave you useful one liners in the comments below.


Please leave a comment or feedback

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

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