I'm sure this is something simple but I cannot figure it out. I am taking input from a manual trigger and populating a SharePoint list after some manipulation in Excel. If the Comments field has text it works fine, but errors out on Create Item when the Comments field is NULL. Is there a way around this?
Solved! Go to Solution.
Can someone give me some detail on how to use the coalesce function? I've seen this solution posted several times but haven't figured out how to use the function.
For example, @equals(coalesce(trigger().outputs?.body?.propertyX, 'NULL'), 'NULL').
Where and how would I apply this in my Flow?
Hi @animartis
Looks like some of the trigger properties were updated
Remove the Comments and checkoincheckout dynamic content and re-map them
Regards,
Reza Dorrani
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly
I deleted both the Check In/Out and Comments, saved, exited, re-opened Flow and added them back. Same issue.
@RezaDorraniI expanded both the manual trigger and Create Item in my original post. Is that what you need?
Hi @animartis
Fill only title field and see if it works
then start filling one by one and then figure out which column is causing the issue
it might be related to a type mismatch between sharepoint column and the value u r providing
Thanks @RezaDorrani
I definitely know that it is the Comments field because I previously had that field mandatory in the manual trigger and it worked fine. It is only when I make the field optional that it errors out. I definitely believe it is related to a NULL value being passed, but I'm not sure how overcome that. I've verified that the SharePoint column is set to not required and is a text field as well. Hope that helps and thanks for the assistance!
Hi @animartis
add a compose action before the create item action
for the compose action set its value as the comments dynamic content
run flow and check value in case of no comment provided
Hey @animartis
This is a known issue with optional input types in manually triggered (or any other trigger that has any manual inputs and those are passed as null) in Flow.
Please take a look at the screenshot below:
You can proabably use this and replicate in your flow too. The manual trigger has a Comment input that is optional. I am trying to initialize a variable with that input and if there is no value passed while triggering the flow, this is bound to fail. And then I am setting an action to run only if that initialize action fails and adding any consecutive steps. At the end remember to add the terminate action with status succeeded or else the flow will register as failed.
And if there are inputs passed in the comments while triggering the flow, the normal path can be followed.
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 haven't tested this yet, but try using the coalesce function.
I might be doing something wrong, but it is not failing at the initialization of the variable, instead it fails at the Create Item. Would this still work?
Can someone give me some detail on how to use the coalesce function? I've seen this solution posted several times but haven't figured out how to use the function.
For example, @equals(coalesce(trigger().outputs?.body?.propertyX, 'NULL'), 'NULL').
Where and how would I apply this in my Flow?
The coalesce() expression returns the first non-null value out of the values that you supply.
It is useful when you want to supply a default value.
coalesce(value1,value2,value3)
Thanks Scott, I finally got it to work! Here is a screenshot of how it looks in the end. I didn't know how to get the right name for the coalesce function (read: n00b) but found that if you peek code or hover over the name it gives you the value.
For the other newbies out there, this expression will look for the first non NULL value (as Scott stated). In this case, it uses the ''.
Unfortunately this doesn't work for me. If I don't provide a value for an optional trigger input, Flow throws an error saying that the respective property doesn't exist. In the flow protocol there is indeed only an output for the trigger if a value was provided, but nothing if no value was provided.
Any idea what I could have done wrong? Or has MS changed the bevaviour of PA since your posts?
UPDATE: okay I found the issue. The question mark in triggerbody()?['property'] was missing. I used the dynamic content tab in Flow to insert it and it omitted this character....very weird from PA side.
Check out new user group experience and if you are a leader please create your group
See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.
User | Count |
---|---|
31 | |
10 | |
8 | |
7 | |
5 |
User | Count |
---|---|
51 | |
22 | |
12 | |
11 | |
9 |