cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
landonjochim
Resolver I
Resolver I

Get Items Filter Query - Last Modified over 2 Hours from Now

I have a Scheduled Flow running every 2 hours. I am using the Get Items action and I would like to retrieve only list items that have not been modified for over 2 hours. I will then perform an action on each of those items.

 

I will use the Filter Query to return only the items that meet this result. Struggling with the formula. 

 

Modified lt subtractFromTime(utcNow(), 2, "Hour")

 

Additional question: Is there anyway to Not run the scheduled flow using Trigger Conditions if there are no items in the list with the Modified over 2 hours ago? I am doubtful here.

 

Please help with the filter query.. Thank you!

1 ACCEPTED SOLUTION

Accepted Solutions
tom_riha
Super User
Super User

Hello @landonjochim ,

Modified lt 'addToTime(utcNow(), -2, 'Hour')'

addToTime(...) must be entered as an exprssion

You can't tell the flow to not run if there're no new items, the flow doesn't know at the time when it's triggering the items it'll process = you can't block it from running.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

View solution in original post

4 REPLIES 4
PrasadAthalye
Community Champion
Community Champion

Use Single quotes instead of double.

 

Modified lt 'subtractFromTime(utcNow(), 2, 'Hour')'

 

 

You can not set trigger condition since there is no reference to SharePoint since its a schedule trigger.

 

Please Like and Mark this as Answer if it resolves your Issue.

Power Automate Community
tom_riha
Super User
Super User

Hello @landonjochim ,

Modified lt 'addToTime(utcNow(), -2, 'Hour')'

addToTime(...) must be entered as an exprssion

You can't tell the flow to not run if there're no new items, the flow doesn't know at the time when it's triggering the items it'll process = you can't block it from running.



[ If I have answered your question, please Accept the post as a solution. ]
[ If you like my response, please give it a Thumbs Up. ]

[ I also blog about Power Automate solutions even for non-IT people. ]

I tried this solution and keep getting the following error that seems to be a format problem but I have no idea on how to fix it.  I looks like the end of the time is slightly different
The expression "2022-06-06T19:41:30Z gt 2022-06-06T18:31:34.2171038Z" is not valid. Creating query failed.

Hello, I am rather new to Power Automate. I will offer this as a possible avenue to explore.

create a substring

dynamically place from where you are getting your date in "Text"

starting position is "0"

length is "10"

Your are telling the program to limit the output of the date to 10. This covers the day, month and year plus -.

Most likely your visual output is 10 characters, but the output you have requested is expressed as many more characters and this is causing confusion. I hope this helps.

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.

Super User 2 - 2022 Congratulations 768x460.png

Welcome Super Users

The Super User program for 2022- Season 2 has kicked off!

Users online (4,293)