cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

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
Highlighted
Helper I
Helper I

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
Highlighted
Community Support
Community Support

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.
Highlighted
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
Community Manager
Power Automate | Power Virtual Agents
Super User Program Manager
Power Platform Communities
Highlighted
Helper I
Helper I

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

Highlighted
Advocate III
Advocate III

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
Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Upcoming Events

Experience what’s next for Power Automate

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Community Conference

Power Platform Community Conference

Find your favorite faces from the community presenting at the Power Platform Community Conference!

Top Solution Authors
Top Kudoed Authors
Users online (6,886)