web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Automate
Answered

If Logic in a Flow

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hello,

I am trying to use an if formula to determine what a field will be set to in one of my flows. My formula does not seem to be working and I can't figure out why. Do the if statements need to written a different way?

 

Right now my formula is:

 

If(triggerBody()?['Term_Sheet_Needs_to_be_Generated__c'] = true, "Need term sheet", If(triggerBody()?['Milestones__c'] = true, "Milestones need to be approved", If(triggerBody()?['Term_Sheet_Generated__c'] = true, "Waiting on App Submission", If(triggerBody()?['Info_Ready_to_be_Reviewed__c'] = true, "Documents Need to Generated", If(triggerBody()?['Docs_Created__c'] = true, "Out for Signing", If(triggerBody()?['Legal_Agreement_Process_Done__c'] = true, "Completed", "Waiting for Materials"))))))
Categories:
  • efialttes Profile Picture
    14,756 on at

    Hi!

    Try to use

    equals(triggerBody()?['Term_Sheet_Needs_to_be_Generated__c'], true)

    instead of 

    triggerBody()?['Term_Sheet_Needs_to_be_Generated__c'] = true

     

    I would also substitute double quotes by single quotes

    Hope it helps

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thanks for your suggestion. I changed my formula to:

     

    If(equals(triggerBody()?['Term_Sheet_Needs_to_be_Generated__c'], true), 'Need term sheet', If(equals(triggerBody()?['Milestones__c'], true), 'Milestones need to be approved', If(equals(triggerBody()?['Term_Sheet_Generated__c'], true), 'Waiting on App Submission', If(equals(triggerBody()?['Info_Ready_to_be_Reviewed__c'], true), 'Documents Need to Generated', If(equals(triggerBody()?['Docs_Created__c'], true), 'Out for Signing', If(equals(triggerBody()?['Legal_Agreement_Process_Done__c'], true), 'Completed', 'Waiting for Materials')))))

     

    Unfortunately, it is still not working. Do you have any more suggestions?

     

    Thank you!

  • efialttes Profile Picture
    14,756 on at

    @Anonymous

     

    Can you provide more details about the error? Can you save the flow with such expression declared? Can you execute the flow? IF so, is the problem related to the fact the expression always provides the same result no matter the input?

    BR 

  • Verified answer
    v-yamao-msft Profile Picture
    Microsoft Employee on at

    Hi chartergrowth,

     

    You may take the following function for a reference:

    if(equals(triggerBody()?['Approved_x003f_'],bool('True')),'need term sheet',if(equals(triggerBody()?['Test2'],bool('True')),'need to be approved','completed'))

     

    In my case, the columns Approved and Test2 are Boolean type(Yes/No). When a new item is created, if the value in the Approved column is false, in Test2 column is true, the function will return “need to be approved”.

    3.PNG

     

    Please adjust the function according to your scenario and try again with it.

     

    Please feel free reply if you need more help.

     

    Best regards,
    Mabel Mao

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    Thank you for your suggestion but it still will not work for me even after I changed my formula.

    I keep getting an error message that says "The expression is invalid". It will not let me even save the flow if I use the formula.

    I have tested the flow without the function and it works perfectly. 

    Thanks!

     

  • v-yamao-msft Profile Picture
    Microsoft Employee on at

    Hi chartergrowth,

     

    What’s your data source? What are the column types? Please show more details about the data source.

     

    Please show me the code you are using on your side. And if possible, please share a screenshot of your flow.

     

    Please make sure all the columns name are correctly used in your code.

     

    Best regards,

    Mabel Mao        

     

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    The data source is Salesforce. 

     

    I am using If(equals(triggerBody()?['Term_Sheet_Needs_to_be_Generated__c'],bool('True')),'Need term sheet',If(equals(triggerBody()?['Milestones__c'], bool('True')),'Milestones need to be approved',If(equeals(triggerBody()?['Term_Sheet_Generated__c'],bool('True')),'Waiting on App Submission',If(equals(triggerBody()?['Info_Ready_to_be_Reviewed__c'],bool('True')),'Documents Need to Generated',If(equals(triggerBody()?['Docs_Created__c'],bool('True')),'Out for Signing',If(equals(triggerBody()?['Legal_Agreement_Process_Done__c'],bool('True')),'Completed','Waiting for Materials')))))

     

    I have checked that all the fields are correct. 

     

    If Logic 1.JPGIf logic 2.JPG

  • Verified answer
    efialttes Profile Picture
    14,756 on at

    @Anonymous

    There is a typo in one of the subexpressions

    If(equeals(triggerBody()?['Term_Sheet_Generated__c']...

    If this is not the problem I would recommend to start with a simple expression (one IF), save, and add the rest of the IFs one by one. I know it takes a lot of time to do it this way, but sometimes when an expression is so complex it is the only way to identify the problem.

    Hope this helps

  • nchambe Profile Picture
    36 on at

    Flow has now improved their condition control to allow more complex nested if/then statements and such using the visual builder. I wrote about it here: https://sharepointlibrarian.com/2019/02/05/flow-now-supports-multiple-condition-controls-for-advanced-if-then-scenarios-within-a-single-step/

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
11manish Profile Picture

11manish 237 Super User 2026 Season 2

#2
David_MA Profile Picture

David_MA 227 Super User 2026 Season 2

#3
Mohsin Ali Profile Picture

Mohsin Ali 194

Last 30 days Overall leaderboard