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

add days to sharepoint list date element

Hey all,

 

may just a small and simple problem.

 

I made a date element (called "date of shipping) in my sharepoint list and want to give myself a reminder if the date is 14 days ahead.

I need a condition and wrote this:

"date of shipping" is equal addDays(utcNow(),14)

This is not working.

any slutions?

 

Thanks 🙂

1 ACCEPTED SOLUTION

Accepted Solutions

Hi @Enrico1109 ,

 

Make sure the date column wouldn't be null in the list.

 

Or create the flow with condition to check if the date column is null as below:

1.png

empty(outputs('Compose'))

 

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

9 REPLIES 9
Super User II
Super User II

Hello @Enrico1109 

 

My guess is that your datetime column contains only a date. The expression you are comparing with is a datetime that contains both date and time. To ensure that your date values are in a comparable format, use the formatDatetime expression for both dates.

Example:

formatDatetime(<shipping date>, 'yyyy-MM-dd') is equal to formatDatetime(addDays(utcNow(), 14), 'yyyy-MM-dd')

 

Are you sure that you want to compare the shipping date with a date 14 days into the future? Or should it be that you want to be notified when there are 14 days till the shipping date? If the later, then the 14 should be a -14 🙂

Kind regards, John

Hello @JohnAageAnderse ,

thank you for your fast answer, 

 

I named the column "shipping date" but yur solution doesn´t work.

It says: The expression is invalid.

May I need to change something in the sharepoint list settings ?

 

Thank You

Hello @Enrico1109 

 

What I wrote was an example 🙂 You have to replace <shipping date> with your column.

In your Condition action you have to use two expressions:

formatDateTime(body('Get_item')?['Created'],'yyyy-MM-dd') - I am using Created as my date column from the list
is equal to
formatDateTime(addDays(utcNow(),-14),'yyyy-MM-dd') - I am using -14 as I want to be notified 14 days before
FlowConditionFormatDatetime.jpg
Kind regards, John

Hi @Enrico1109 ,

 

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

Please make sure the "shipping date" is new created column (not a updated name column).

If the flow as screenshot below:

1.png

The expression should as below:

formatDateTime(items('Apply_to_each')?['shippingdate'],'yyyy-MM-dd')
formatDateTime(addDays(utcNow(),14),'yyyy-MM-dd')

 

If the flow as below:

2.png

The expression should as below:

formatDateTime(triggerBody()?['shippingdate'],'yyyy-MM-dd')
formatDateTime(addDays(utcNow(),14),'yyyy-MM-dd')

 

 

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.

Hey @v-alzhan-msft 

 

Thank you for your help

My Power Automate is in German, I hope you can understand it.

 

Enrico1109_0-1592548043873.png

 

formatDateTime(body('Elemente_abrufen')?['AnkunftderWare'])
is euqual to
formatDateTime(addDays(utcNow(),14))
 
The column is new created.
 
Thank you
 
Best regards,
Enrico
 
 
 
 
 

Hi @Enrico1109 ,

 

Create the flow as below:

1.png

The expression should as below:

formatDateTime(outputs('Compose'),'yyyy-MM-dd')
formatDateTime(addDays(utcNow(),14),'yyyy-MM-dd')

 

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.

 

@v-alzhan-msft 

 

It shows me this error:

Enrico1109_0-1592553235127.png

 In text:

InvalidTemplate. Vorlagensprachausdrücke für Aktion "Bedingung" in Zeile "1" und Spalte "2877" können nicht verarbeitet werden: Die Vorlagensprachfunktion "formatDateTime" erwartet als ersten Parameter einen Parameter vom Typ "string". Der angegebene Wert ist vom Typ "Null". Details zur Syntax finden Sie unter https://aka.ms/logicexpressions#formatdatetime..
 
 

Hi @Enrico1109 ,

 

Make sure the date column wouldn't be null in the list.

 

Or create the flow with condition to check if the date column is null as below:

1.png

empty(outputs('Compose'))

 

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

It worked 🙂 Thank you very much for your help

 

Best Regards

Enrico

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Top Solution Authors
Top Kudoed Authors
Users online (11,085)