
Have you ever wondered why the Expression box in Microsoft Flow is so small?
Low code expressions
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.
Sometimes it is the small things in power Automate 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. Once you created a compose action and set this to
workflow()
Then you can use the following expression to build the url of the current run of the flow.
concat('https://unitedkingdom.flow.microsoft.com/manage/environments/',
outputs('Compose')['tags']['environmentName'],
'/flows/',
outputs('Compose')['name'],
'/runs/',
outputs('Compose')['run']['name'])
For more details see my post about finding your run Url.
The above should still redirect however if you want to construct the new flow run URL then you could include the following directly into you send an email action.
https://make.powerautomate.com/environments/@{workflow().tags.environmentName}/flows/@{workflow().id}/runs/@{workflow().run.name}
Expression 2 – Format your dates
Formatting dates is easy in Power Automate
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)

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.

coalesce(triggerBody()?['Choice']?['Value'],'Unknown')
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.

Leave a Reply
You must be logged in to post a comment.