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

Inconsistent Behaviour When Fomatting Date

I have built 2 Flows linked to a SharePoint list both of which send emails. Both emails include a date field in the message body and, as by default the date is in the format yyyy-mm-dd, I have added formatting (with an additonal check that a date has been entered)

 

if(equals(triggerBody()?['TaskDueDate'],null),'Due date not set',formatDateTime(triggerBody()?['TaskDueDate'],'dd/MM/yyyy'))

 

This works fine for the first Flow I created but for the second I get "Due Date not set" as the output. I coped the expression from the first Flow, both are using the same list item for testing and when I output the field with no formatting it outputs the correct date.

 

I can't see why the behaviour is different, has anyone come across this before?

 

thanks

Neil

 

3 REPLIES 3
Super User III
Super User III

@NeilSantucci 

Sounds really weird, and very frustrating. My only guess is that one of your flows is updating the item, so when the other flow is reading it, the value is not NULL anymore.

 

Have you tried with coalesce() function as a workaround?

https://docs.microsoft.com/en-us/azure/logic-apps/workflow-definition-language-functions-reference#c...

 

For example, adding a Compose action block before evauating your condition:

coalesce(triggerBody()?['TaskDueDate'],'Due date not set')

 

It can help you to doublecheck if your variable is null from second service logic point of view

Hope this helps

 

 


Each time you click on any of our inspiring answers 'Thumb up' icon...
...an ewok scapes from the stormtroopers.

Be grateful, Thumbs up! Save the Galaxy for free!


Escribo sobre Power Automate en:
https://medium.com/anyone-can-automate/

Proud to be a Flownaut!



Definitely Frustrating!

 

The problem isn't that the field is being updated, neither flow changes this field so it's always populated. I've also switched off the Flow I wasn't working to stop unnecessary emails so they wouldn't be able to conflict.

Hi @NeilSantucci ,

If you could provide an expanded screenshot of your Flow and steps, and of any detailed error messages you're receiving we could likely better assist you.

I have made a test on my side, it can works well:

The expression in Compose is:

if(equals(triggerBody()?['TaskDueDate'],null),'Due date not set',formatDateTime(triggerBody()?['TaskDueDate'],'dd/MM/yyyy'))

Capture1.PNGCapture2.PNG

Best Regards,

Community Support Team _ Zhongys

If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

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 (42,131)