cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper II
Helper II

Flow Fails when Comments Field in Manual Trigger is NULL

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?

 

Issue with NULL Value.jpgFlow Error.jpg

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Helper II
Helper II

Re: Flow Fails when Comments Field in Manual Trigger is NULL

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?

View solution in original post

14 REPLIES 14
Highlighted
Dual Super User II
Dual Super User II

Re: Flow Fails when Comments Field in Manual Trigger is NULL

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

Highlighted
Helper II
Helper II

Re: Flow Fails when Comments Field in Manual Trigger is NULL

I deleted both the Check In/Out and Comments, saved, exited, re-opened Flow and added them back. Same issue.

Highlighted
Dual Super User II
Dual Super User II

Re: Flow Fails when Comments Field in Manual Trigger is NULL

@animartis 

 

share screenshot of create item action (I want to see all the properties)

Highlighted
Helper II
Helper II

Re: Flow Fails when Comments Field in Manual Trigger is NULL

@RezaDorraniI expanded both the manual trigger and Create Item in my original post. Is that what you need?

Highlighted
Dual Super User II
Dual Super User II

Re: Flow Fails when Comments Field in Manual Trigger is NULL

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

Highlighted
Helper II
Helper II

Re: Flow Fails when Comments Field in Manual Trigger is NULL

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!

Highlighted
Dual Super User II
Dual Super User II

Re: Flow Fails when Comments Field in Manual Trigger is NULL

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

 

Highlighted
Dual Super User III
Dual Super User III

Re: Flow Fails when Comments Field in Manual Trigger is NULL

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: 

Err1.PNG

 

Err2.PNG

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!

Highlighted
Super User III
Super User III

Re: Flow Fails when Comments Field in Manual Trigger is NULL

@animartis 

I haven't  tested this yet, but try using the coalesce function.

 

 

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

Scott
Highlighted
Helper II
Helper II

Re: Flow Fails when Comments Field in Manual Trigger is NULL

@yashag2255 

 

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?

Highlighted
Helper II
Helper II

Re: Flow Fails when Comments Field in Manual Trigger is NULL

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?

View solution in original post

Highlighted
Super User III
Super User III

Re: Flow Fails when Comments Field in Manual Trigger is NULL

@animartis 

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)

 

 

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

Scott
Highlighted
Helper II
Helper II

Re: Flow Fails when Comments Field in Manual Trigger is NULL

@ScottShearer 

 

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 ''.

 

pic1.jpgpic2.jpg

Highlighted
Helper II
Helper II

Re: Flow Fails when Comments Field in Manual Trigger is NULL

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.

 

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Tech Marathon

Maratón de Soluciones de Negocio Microsoft

Una semana de contenido con +100 sesiones educativas, consultorios, +10 workshops Premium, Hackaton, EXPO, Networking Hall y mucho más!

Users online (9,092)