Hello Community,
I'm trying to send a mail in Flow gathering information from my SharePoint list whenever a form has been submitted. However when I try to gather information from a Yes/No column it shows as true or false. I want to have this text changed and I have tried various Expressions without any luck. I found a topic where someone asked the same question, however he wanted it when true show none and when false that it creates a custom text.
if(triggerBody()?['ColumnName'],null, 'Change wire')
I simply want to change my YES/NO column to the text YES/NO instead of true or false.
Thanks.
Solved! Go to Solution.
Hey @Fouad
Try using this expression now
if(empty(string(body('Get_item')?['Klantgegevens'])),null,if(equals(body('Get_item')?['Klantgegevens'],true),'Yes','No'))
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Hey @Fouad
Can you share a screenshot of the flow? note that True/false are the actual values for yes/no (yes and no are basically labels). therefore to check that in flow, you need to check with true/ false (boolean values).
The expression you shared is a bit incomplete. are you trrying to check if the trigger body column name is null? if so you need to add teh equals expression too.
if(equals(triggerBody()?['ColumnName'],null),value iftrue, valueiffalse)
If you can share more details, we might better assist you with this.
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Additional information:
- Connected to SharePoint list
- This SharePoint column is Yes/No type of column
- When I run this 'Send an email' Flow it shows me either - False if I selected 'No' in my Form and True if I selected 'Yes' in my Form
Hey @Fouad
for Yes/No column type of true/false boolean values, you can use this expression on a variable:
Initialise a variable and in the expression :
if(empty(triggerBody()?['ColumnName']),null,if(equals(triggerBody()?['ColumnName'],'true'),'Yes','No'))
This will change the value to Yes if the boolean is true.
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Unfortunately this did not help me.. when I select 'Yes' for boolean it gives me true (just like how it did before) - Column name is: Klantgegevens
This is what it says in mail
This is where I placed the variable in HTML body.
if(empty(triggerBody()?['Klantgegevens']),null,if(equals(triggerBody()?['Klantgegevens'],true),'Yes','No'))
Hey @Fouad
It is not working because you are referring to the wrong field. Which action is returnign the yes/no type field?
I tested with a get items action and in the apply to each I am sending some stuff so based on that the expression is:
if(empty(string(items('Apply_to_each')?['TaskStatus'])),null,if(equals(items('Apply_to_each')?['TaskStatus'],true),'Yes','No'))
Here, taskstatus is the column name and is of type yes/no and the apply to each is iterating over each item from the get items.
if you are doing it on the get item action, replace the reference to the field accordingly.
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
What am I doing wrong here 😕
Hey @Fouad
You are initializing the wrong type of variable at the wrong place. Basically you won't need to set a variable for this. If you can share some details on the scenario that you are building, I might be able to assist you better with this
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
I'll try to explain my builded Flow in pictures, the last 2 Flows 'Send an email' has almost the same body.
Hopefully you can help me this way better..
Hey @Fouad
Try using this expression now
if(empty(string(body('Get_item')?['Klantgegevens'])),null,if(equals(body('Get_item')?['Klantgegevens'],true),'Yes','No'))
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
This worked for me thanks!!
How do I make the same expression but then when the attachment has been added to the SharePoint list?
Hey @Fouad
Can you share more details? Note that while creating expressions, if you want to use the dynamic content in the expression, try writing the expression and selecting the dynamic content within the expression to avoid any errors over there. Yuo can also initialize some variables and assign the values to that variables and use them in expressions initially for a better understanding.
Hope this Helps!
If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up. THANKS!
Thanks. I got it right by the following code:
if(empty(string(body('Get_item')?['{HasAttachments}'])),null,if(equals(body('Get_item')?['{HasAttachments}'],true),'Yes','No'))
User | Count |
---|---|
25 | |
15 | |
14 | |
10 | |
9 |
User | Count |
---|---|
48 | |
29 | |
28 | |
25 | |
23 |