cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
DWirth
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
ScottShearer
Super User
Super User

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
ScottShearer
Super User
Super User

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
v-yuazh-msft
Community Support
Community Support

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

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
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 (2,037)