cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

Use If Expression to Evaluate a Variable

I am trying to write an if expression to return a specific value if the statement is true.  Here is what I am hoping to accomplish.

 

I have a variable of type String:  strAutoRenewValue that is set using a Yes/No column in SharePoint Document Library column.  If the value is Yes, I want it to return "IS" or "IS NOT" if No. Below is what I have been I get expression not valid. What am I doing wrong?

 

if(equals(strAutoRenewValue, 'Yes'), 'IS''IS NOT')
 
Thank you.
1 ACCEPTED SOLUTION

Accepted Solutions
v-bacao-msft
Community Support
Community Support

 

Hi @Anonymous ,

 

Please try the following configuration:

83.PNG84.PNG

if(equals(variables('strAutoRenewValue'),true),'IS','IS NOT')

 

Best Regards,

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

View solution in original post

6 REPLIES 6
ManishJain
Solution Sage
Solution Sage

Hi @Anonymous ,

 

Please use this expression :
 
if(equals(variables(variables('strAutoRenewValue')), 'Yes'), 'IS''IS NOT'
 
Thanks
Anonymous
Not applicable

Thank you @ManishJain .  When I tried to save I get the following error that I am not sure what to do with. Seems like variables in the expressions need to declare?

 

The template validation failed: 'The template action 'SetAutoRenewalValue' at line '1' and column '6094' is not valid: "The template function 'variables' is not expected at this location.".'.

Hi @Anonymous ,

 

Don't you have variable "strAutoRenewValue " declared at the beginning to be precise. Please share screenshot of your flow to help further.

 

Thanks

Anonymous
Not applicable

I do. Here is a screenshot.

 

Screenshot2.jpg

Screenshot.jpg

@ManishJain 

If this is a SharePoint Yes/No column, you need to be testing in you if expression or condition for true or false and not Yes or No.

if(equals(strAutoRenewValue, true), 'IS''IS NOT')

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Scott
v-bacao-msft
Community Support
Community Support

 

Hi @Anonymous ,

 

Please try the following configuration:

83.PNG84.PNG

if(equals(variables('strAutoRenewValue'),true),'IS','IS NOT')

 

Best Regards,

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

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Top Kudoed Authors
Users online (4,243)