cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
New Member

Flow fails when field not populated

Is there a workaround for allowing a flow to run when it's calling a field that has no data populated? I have a sharepoint list with an optional field for a phone number. I need it to send an email and contain the phone number if it's included but since it's an optional field it's not required and not always populated. I still need the email to be sent though. Short of populating the field with a default value and sending that, is there a way to allow the flow to complete without having populated data for optional fields?

Thanks!

6 REPLIES 6
Kudo Kingpin
Kudo Kingpin

@cpierich

According to https://msdn.microsoft.com/en-us/library/azure/mt643789.aspx you can use this expression in a condition block to handle null trigger outputs

@coalesce(trigger().outputs?.body?.property1, 'my default value')

 

I implemented a test flow with a New Sharepoint item trigger, the following condition

@equals(coalesce(trigger().outputs?.body?.propertyX, 'NULL'),  'NULL')

On the YES branch I included a "Send email" action block for confirmation purposes, leaving the NO branch empty. 

 

In the Sharepoint list definition I included an optional column (propertyX), then I added an iten without filling the optional column.

The flow succeded and I received the confirmation email. But when opening again the flow for editing purposes the following error is displayed:

"unexpected character '?', mode 3"

and no flow block is displayed anymore.

 

Assuming this is the way to proceed, It will be more user frienly if the condition block offers an option called "not present" and internally converts it to the above expression

 

@cpierich

I found another thread in this community where @Samuel explains the use of coalesce much much better than my previous post.

 

https://powerusers.microsoft.com/t5/Flow-Forum/Is-there-a-way-to-process-null-values-from-CRM-to-Sha...

 

As Samuel suggests, a simpler solution than the one I proposed in my previous post can be the following: invoke coalesce in the email body.

 

@{coalesce(triggerBody()['telephoneproperty'], 'no telephone nr available')}

 

According to the documentation, coalesce returns the first non-null object in the arguments passed in. Note: an empty string is not null. For example, if parameters 1 and 2 is not defined, this will return fallback: coalesce(parameters('parameter1'), parameters('parameter2') ,'fallback')

 

 

Hope this helps

 

 

 

 

 

Frequent Visitor

I have over 70 variables that could possibly be null. Do I have to write a coalesce expression for each single variable?

Did you find an anwert to your question and implemented coalesce for all 70 variables?. I am on a same boat and doing so would be tedious and error prone

Helper II
Helper II

Maybe an idea:

Having empty values in Select action caused issues so needed a way to use default value in case of empty. This solution worked for me!

flow empty select.JPG

 

if(empty(item()?['Address']),'blank',item()?['Address'])

Administrator
Administrator

Hello, @cpierich!

 

Thank you for posting on the Flow Community Forum! Have you had an opportunity to apply @Lexnnn‘s recommendation to adapt your Flow? If yes, and you find that solution to be satisfactory, please go ahead and click “Accept as Solution” so that this thread will be marked for other users to easily identify!


Thank you for being an active member of the Flow Community!

 

-Gabriel
Flow Community Manager

- Gabriel
Community Manager
Power Automate | Power Virtual Agents
Super User Program Manager
Power Platform Communities

Helpful resources

Announcements
New Super Users

Meet the Power Automate Super Users!

Many congratulations to the Season 1 2021 Flownaut Crew!

New Badges

New Solution Badges!

Check out our new profile badges recognizing authored solutions!

MPA Community Blog

Power Automate Community Blog

Check out the community blog page where you can find valuable learning material from community and product team members!

Users online (84,112)