Let's POWER Automate

From no-code to low-code

Menu
  • Expressions
  • Filters
  • General
  • Application specific solutions
    • Dataverse
    • Excel
    • Forms
    • Planner
    • Outlook
    • SharePoint
    • Teams
  • Triggers
  • Resources
  • ABOUT ME
  • Get help with your flow
Menu

Most common reasons for an invalid expression in Power Automate

Posted on December 26, 2021August 23, 2022 by Tom

“Power Automate editor tells me that “The expression is invalid” but it doesn’t tell me what’s wrong, how can I fix it?”


“The expression is invalid”. That’s all the information you receive when adding an expression to your flow. But why is it invalid? Which part of the expression must be fixed? What are the most common causes of an invalid expression? This post describes the problems I see all the time.

Power Automate invalid expression

Wrong single quote character

All the expressions use the same separators – a comma between parameters, and single quotes to define parameter values. The single quote must be always a specific character, the one used in the designer:

'

If you copy the expression from a page that uses a rich text editor, it might show a different one, e.g.

‘

It’s a small difference from the user perspective, but a big difference from Power Automate point of view.

formatDateTime(utcNow(),'yyyy-MM-dd')   - OK
formatDateTime(utcNow(),‘yyyy-MM-dd’)   - NOT OK

Single quotes around expression or dynamic value

The single quotes should be used only if you type in a value as a parameter. If you use dynamic content or another expression in an expression, it must be without the quotes.

formatDateTime(utcNow(),'yyyy-MM-dd')           - OK
formatDateTime('2021-12-26','yyyy-MM-dd')       - OK
formatDateTime(outputs('Compose'),'yyyy-MM-dd') - OK
formatDateTime('utcNow()','yyyy-MM-dd')         - NOT OK (even though the editor will accept it)
formatDateTime(2021-12-26,'yyyy-MM-dd')         - NOT OK

Too many or too few single quotes

The single quotes must be always in a pair. If there’s a single quote before the value, there must be exactly one after the value too.

Missing or misplaced closing brackets

The same applies also to brackets. Each expression must have an opening and a closing bracket, and they must be at the right place, after all the parameters. If you build a complex expression, e.g. as in the post on extracting previous SP column values, it’s easy to get lost in the brackets. That’s when you should use a good code editor – I personally use Visual Studio Code.

If you enter the expression in the editor, it’ll highlight the corresponding brackets. That helps a lot to identify if you have all the brackets, and if they’re in the right place.

The flow editor whim

The problem I encounter most often myself is the editor whim. When I enter the expression, it’ll state that the expression is invalid. But only on the first try, after one copy/paste it’ll accept the expression as it is. Sometimes it just needs two attempts instead of one.

Summary

As you can see, there’re multiple reasons why Power Automate can give you “The expression is invalid” error message. But if you follow the points in this post, you should be able to identify the problem and quickly fix it.


Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Do you know what to do, but not how to do it?

Get The Ultimate Power Automate expressions cheat sheet and translate your thoughts into flows with ease!


There's also the HTTP requests to SharePoint cheat sheet to help you overcome limitations of some standard actions!

Do you struggle with the various expressions, conditions, filters, or HTTP requests available in Power Automate?

I send one email per week with a summary of the new solutions, designed to help even non IT people to automate some of their repetitive tasks.

All subscribers have also access to resources like a SharePoint Filter Query cheat sheet or Date expressions cheat sheet.

Zero spam, unsubscribe anytime.

Didn't find what you were looking for?
Need to adjust a solution to fit your needs?
Or would you just like to get an assistance from somebody with 1000s of hours of experience with Power Automate?

Power Automate blogs worth visiting

Damien Bird
Dennis (Expiscornovus)
Paul Murana

©2023 Let's POWER Automate | Theme by SuperbThemes