cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Anonymous
Not applicable

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
efialtes
Kudo Kingpin
Kudo Kingpin

@Anonymous

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

 

@Anonymous

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-SharePoint/m-p/1075/highlight/true#M25

 

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

 

 

 

 

 

Mack
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

Lexnnn
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'])

GabrielStJohn
Community Champion
Community Champion

Hello, @Anonymous!

 

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



Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (1,570)