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:
Solved! Go to Solution.
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”.
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
@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
Proud to be a Flownaut!
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
Proud to be a Flownaut!
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!
@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
Proud to be a Flownaut!
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”.
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
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!
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
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.
@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
Proud to be a Flownaut!
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-advance...
The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.
Learn to digitize and optimize business processes and connect all your applications to share data in real time.
User | Count |
---|---|
12 | |
10 | |
10 | |
9 | |
6 |
User | Count |
---|---|
26 | |
20 | |
12 | |
11 | |
10 |