cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
pdreger
New Member

Use of the Sharepoint Created Column in Get ITems query fails with Created tagged as note in Valid Date Time format


I am running a Get ITems query trying to compare todays date to the Created date (the sharepoint list standard item not something I added)


I have been trying using the expression editor as follows formatDateTime( utcNow(),'yyyy-MM-dd') gt addDays('Created',7,'yyyy-MM-dd')

I get an error message that "the value provided for date time string 'Created' was not valid."

i've also tried replacing 'Created' with item()?['Created'] and even tried formatDateTime(addDays('Created',7),'yyyy-MM-dd') but I get the same message

I've checked the list setting and the item is called Created and it's in Date and Time format I've also checked every row in the list and they all have a Created date.

I've also created a new list without anything but the default columns and Created is one of the default

In desperation I ran a compose to display the Created date and I get the same error message.

Any thoughts, hints or pointers?

1 ACCEPTED SOLUTION

Accepted Solutions
v-xiaochen-msft
Community Support
Community Support

Hi @pdreger ,

 

Please try this expression:

vxiaochenmsft_0-1646640852275.png

Created lt '@{formatDateTime(addDays(utcNow(),-7),'yyyy-MM-dd')}'

 

Best Regards,

Wearsky

 

View solution in original post

3 REPLIES 3
shoog
Super User
Super User

When you pass 'Created' as a parameter to addDays, it will be used as a text literal. It should be Created without the quotes.

 

Also, are you trying to get one item or multiple? Get items will return an array, whereas Get item will return only one.

If you want multiple, any further processing should be inside a for each loop where you can refer to the Created field using items('Apply_to_each')['Created']

v-xiaochen-msft
Community Support
Community Support

Hi @pdreger ,

 

Please try this expression:

vxiaochenmsft_0-1646640852275.png

Created lt '@{formatDateTime(addDays(utcNow(),-7),'yyyy-MM-dd')}'

 

Best Regards,

Wearsky

 

pdreger
New Member

THe UTC - 7 was the approach was what I ended up using. Could never get Power Automate to treat the Sharepoint Created value as a date field. 

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.

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.

Power Automate Designer Feedback_carousel.jpg

Help make Flow Design easier

Are you new to designing flows? What is your biggest struggle with Power Automate Designer? Help us make it more user friendly!

Top Solution Authors
Users online (3,641)