cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
randalloglesby
Level: Powered On

Expressions using "if" that worked last week are broken now.

I spent countless hours last week getting a flow to work using some variables, but I log in this week and see that they aren't working anymore. I gett the following error:

 

"InvalidTemplate. Unable to process template language expressions in action 'Manager_Approval_Email' inputs at line '1' and column '2559': 'The template language function 'if' expects its first parameter to be of type boolean. The provided value is of type 'String'. Please see https://aka.ms/logicexpressions#if for usage details.'"

 

This is the expression that's failing:

 

if(variables('Reports to Shayna'),'shayna@studiofathom.com', body('Get_manager_(V2)')?['mail'])
It's my understanding that it should work like this: If "Reports to Shayna" is True, use shayna@studiofathom.com. If it is False, get the email from Get_manager_(V2) and insert it here.
 
Why is this not working anymore?
1 ACCEPTED SOLUTION

Accepted Solutions
randalloglesby
Level: Powered On

Re: Expressions using "if" that worked last week are broken now.

That's pretty much how I have it set up.

 

My 'Reports to Shayna' variable is reading out "False" in this test, so shouldn't it be using 'test2@companyname.com' as the result?

 

I was able to get it to work by using this:

if(equals(variables('reports'),"True'),'test1@company.com','test2@company.com')

View solution in original post

4 REPLIES 4
Community Support Team
Community Support Team

Re: Expressions using "if" that worked last week are broken now.

Hi @randalloglesby,

 

It seems that you have set Variables in your flow.

 

I made a test on my side with the similar code to check if the email has an attachment, if yes, sent email to email address1, if no, sent to the sender.

 

It works fine without error.

 

The code I am using is:

if(variables('reports'),’test1@company.com,’test2@companyname.com’)

 

please check the following screenshot:

2.PNG

 

Have you modified the flow with the variables? Please try to recreate the flow to see if it will wrok.

 

 

Best regards,

Mabel Mao

Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Administrator
Administrator

Re: Expressions using "if" that worked last week are broken now.

Hello, @randalloglesby!

Have you had an opportunity to apply @v-yamao-msft‘s recommendation to adapt your Flow? If yes, and you find that solution to be satisfactory, please go ahead and click “Accept as Solution” so that this thread will be marked for other users to easily identify!


Thank you for being an active member of the Flow Community!

-Gabriel
Flow Community Manager

-Gabriel
Microsoft Power Automate Community Manager
Are YOU a member of your local Power Automate User Group?
Fill out This Form to claim your Community User Group Member Badge!
randalloglesby
Level: Powered On

Re: Expressions using "if" that worked last week are broken now.

That's pretty much how I have it set up.

 

My 'Reports to Shayna' variable is reading out "False" in this test, so shouldn't it be using 'test2@companyname.com' as the result?

 

I was able to get it to work by using this:

if(equals(variables('reports'),"True'),'test1@company.com','test2@company.com')

View solution in original post

crf200
Level: Powered On

Re: Expressions using "if" that worked last week are broken now.

Is there a way to run the 'IF' function on a boolean without initializing a Variable function. I'm running into an issue initializing a variable within an 'Apply to each'.

 

I'm trying to establish a line of text being added to a field into an output based on an previous boolean. Here is what I'm trying

 

if(equals(items('ATE')?['field'], 'true'), "RBC: ","")

 

Where if the boolean reads true then it adds the string "RBC: " to the output.

 

There are some pretty complex 'Apply to each' functions at this point in the flow and variables aren't an option.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,850)