cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Frequent Visitor

Microsoft Flow Does Not Like NULL

Hi All,

 

I currently have a flow which translate the datetimeformat into the correct format I need.

 

The expression: formatdatetime(triggerBody()?['End_x0020_or_x0020_Termination_x'],'MM-dd-yyyy')

 

The above expression works perfectly, but I need to add some additional rules in place.  The field I have can sometimes come back with a NULL value, which Flow does not like.

 

I tried the below expression but it didn't seem to work.. I need the expression to update the datetimeformat and also change the value from NULL to 'Never'.

 

Tried: if(equals(triggerBody()?['End_x0020_or_x0020_Termination_x'],'NULL'),'NULL'),'',formatdatetime(triggerBody()?['End_x0020_or_x0020_Termination_x'],'01/01/1901'),'MM-dd-yyyy'))

 

Can anyone point me in the right direction to be able to do both in the same expression?

 

Thank you!

 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: Microsoft Flow Does Not Like NULL

Try using either the empty() or coalesce() function in your expression.

 

Documentation can be found here: 

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

Scott

View solution in original post

3 REPLIES 3
Highlighted
Super User III
Super User III

Re: Microsoft Flow Does Not Like NULL

Try using either the empty() or coalesce() function in your expression.

 

Documentation can be found here: 

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

Scott

View solution in original post

Highlighted
Community Support
Community Support

Re: Microsoft Flow Does Not Like NULL

Hi @ jmccann,

 

Could you please share a screenshot of the configuration of your flow?

Please take a try to add a condition under the trigger to check if the "End or Termination "column is null when an item is created in the sharepoint list.

 

Please refer to screenshot below to create the flow:

Capture.PNG

 

The expression in the condition as below:

@not(empty(triggerBody()?['End_x0020_or_x0020_Termination_x']))

The expression in the compose as below:

formatdatetime(triggerBody()?['End_x0020_or_x0020_Termination_x'],'MM-dd-yyyy')

When an item is created, if the "End or Termination "column is null, the flow would run successfully as below:

Capture.PNG

 

When an item is created, if the "End or Termination "column is not null, the flow would run successfully as below:

Capture.PNG

 

Please let me know if your issue could be solved.

 

 

 

Regards,
Alice Zhang

Highlighted
Frequent Visitor

Re: Microsoft Flow Does Not Like NULL

Thanks Scott! This worked a treat..

 

I used:

 

if(equals(coalesce(triggerBody()?['End_x0020_or_x0020_Termination_x'],'NULL'),'NULL'),'',formatdatetime(coalesce(triggerBody()?['End_x0020_or_x0020_Termination_x'],'01/01/1901'),'dd/MM/yyyy'))

Helpful resources

Announcements
firstImage

Super User Program Update

Three Super User rank tiers have been launched!

firstImage

Power Platform 2020 release wave 2 plan

Features releasing from October 2020 through March 2021

firstImage

Join the new Power Virtual Agents Community!

We are excited to announce the launch of Power Virtual Agents Community. Check it out now!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

Top Solution Authors
Top Kudoed Authors
Users online (10,330)