string comparison not working in Power Automate? know when it can fail.

Welcome to all my blog readers. Today’s blog post is rather interesting. A look at the title of the blog and you might be wondering – “What can be new here? Isn’t it the simplest of the functionalities to implement?”.

Can’t deny that it is indeed simple. But sometimes the simplest of things can be a challenge and in fact takes longer time to resolve.

Let’s see the problem. To demonstrate the problem, I created a very simple Power Automate flow. The flow trigger when an account is created and it checks for the account name.

string comparison not working in Power Automate

I check if the Account Name is equal to 311 and then decide the next step of action. The account name field is of type string.

The expected result is when I create an account with name 311, it should evaluate to true. But when I created the account with name 311, below is the flow path.

string comparison not working in Power Automate

As you can see, the condition expression evaluates to false. However if I have text comparison like ‘Account name” is equal to New Account 311, it shall work fine.

The reason for that is even if you compare with a text field, if you compare a number, Power automate will think of it as whole number. And string value of 311 is different from integer value 311.

In cases when you want a string comparison for a number even with a text field, always use the string function.

string comparison not working in Power Automate

Now when I run the flow, it works as expected.

string comparison not working in Power Automate

It is very simple. But trust me, it’s these simple errors which are so easy to overlook.

Hope this helped. You will also like the below posts.

Debajit Dutta
Business Solutions MVP