cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Post Prodigy
Post Prodigy

how to update date format for a date field if not null in select action

Hi,

 

I am using flow select action under which I have a field called 'completiondate' that is populated for some rows in sp list and not for some rows. So it works well but now I have a requirement to update the date format to mm/dd/yyyy so when using formatdatetime(item()?['CompletionDate'],'MM/dd/yyyy') as expression , it fails and says supplied value were null and it makes sense because some rows do not have completiondate populated.

 

can someone help me with a fix here, so if date is returned null then leave it null, if populated then update it with format mm/dd/yyyy for select action expression, please help, thanks in advance. 

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Community Support
Community Support

Re: how to update date format for a date field if not null in select action

Hi @dmistry ,

 

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

Please make sure the expression below for the CompletionDate is correct:

item()?['CompletionDate']
 
And then you could take a try with expression below:

 

if(empty(item()?['CompletionDate']),item()?['CompletionDate'],formatdatetime(item()?['CompletionDate'],'MM/dd/yyyy'))

 

 

 

Best regards,

Alice   

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

4 REPLIES 4
Highlighted
Microsoft
Microsoft

Re: how to update date format for a date field if not null in select action

Hi @dmistry,

 

Have you tried to use a Condition action in Flow to verify the date before applying the formate date expression? 

 

image.png

Encapsulating this condition inside an Apply to each, could help identify if the completiondate field is getting populated or not, before attempting to formate the date.

 

Let me know if this helped!

 

Regards,

Ricardo 

Highlighted
Microsoft
Microsoft

Re: how to update date format for a date field if not null in select action

Hi @dmistry 

 

I think you can achieve this by including a condition that checks on the date prior to updating the format, if the date exists then you can modify the format, in the other branch of the condition you can indicate date as null.

 

Best Regards,

If this post helps you give a :thumbs_up: and if it solved your issue consider Accept it as the solution
Highlighted
Community Support
Community Support

Re: how to update date format for a date field if not null in select action

Hi @dmistry ,

 

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

Please make sure the expression below for the CompletionDate is correct:

item()?['CompletionDate']
 
And then you could take a try with expression below:

 

if(empty(item()?['CompletionDate']),item()?['CompletionDate'],formatdatetime(item()?['CompletionDate'],'MM/dd/yyyy'))

 

 

 

Best regards,

Alice   

Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

 

View solution in original post

Highlighted
Post Prodigy
Post Prodigy

Re: how to update date format for a date field if not null in select action

@v-alzhan-msft excellent, this is what I was looking for!

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

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 (7,311)