cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Anonymous
Not applicable

Get List Items problem

Hi so im trying to create an action tracker that can send email notifications when an action is past its due date. So I used the Get Items command to in a way scan all the items to see if there are due and if they are the flow will send an email to the stakeholder informing him/her that it is due. However when I run the flow it sends all the items I the list regardless if they are due or not. Here are some pictures to assist you to help me.
Flow:Flow.png

Expression I used:

Expression.png

List I createdList.png

2 ACCEPTED SOLUTIONS

Accepted Solutions
Highlighted
Super User II
Super User II

Re: Get List Items problem

Hey @Anonymous 

Have you considered using a a query filter rather than getting all of the list items and then filtering in Flow? This is much better practice as you're only retrieving those items which need to be processed... if you retrieve all items and then filter in Flow you're processing way more data and you will run into issues when your list exceeds 5000 items.

The filter expression would be something similar to: DueDate le '@{formatDateTime(utcNow(),'yyyy-MM-dd')}' and Status ne 'Complete'

1.png

NOTE: The query filter uses the list internal names and you need to make sure you pass in the correct column name in the query filter... most folk assume the space will always be encoded with '_x0020_' so Due Date becomes 'Due_x0020_Date'... but that isn't the case... the modern experience will remove the space so 'Due Date' becomes 'DueDate'. You can check by going to you list settings in SharePoint then click on the column and then check the URL value:

1.png

 

If you'd rather filter the array in Flow use the filter array action rather than a condition (Example below...you just need to add the filter criteria):

1.png

HTH

Jay

View solution in original post

Highlighted
Super User II
Super User II

Re: Get List Items problem

Hi @Anonymous 

 

The issue is that, when you do the formatDate, you're converting the result to a string, so you're comparing a String with a Date. You should keep the uctNow(), and since both are dates, then you'll be able to make the comparison.

 

Also, you can make a comparison when you fetch the items so that you get fewer items. To achieve that here's an example:

small-Screenshot_2020-01-03_at_10_16_17.jpg

 

Please don't forget the "x0020" since there's a space between Due Date.

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

View solution in original post

5 REPLIES 5
Highlighted
Super User II
Super User II

Re: Get List Items problem

Hey @Anonymous 

Have you considered using a a query filter rather than getting all of the list items and then filtering in Flow? This is much better practice as you're only retrieving those items which need to be processed... if you retrieve all items and then filter in Flow you're processing way more data and you will run into issues when your list exceeds 5000 items.

The filter expression would be something similar to: DueDate le '@{formatDateTime(utcNow(),'yyyy-MM-dd')}' and Status ne 'Complete'

1.png

NOTE: The query filter uses the list internal names and you need to make sure you pass in the correct column name in the query filter... most folk assume the space will always be encoded with '_x0020_' so Due Date becomes 'Due_x0020_Date'... but that isn't the case... the modern experience will remove the space so 'Due Date' becomes 'DueDate'. You can check by going to you list settings in SharePoint then click on the column and then check the URL value:

1.png

 

If you'd rather filter the array in Flow use the filter array action rather than a condition (Example below...you just need to add the filter criteria):

1.png

HTH

Jay

View solution in original post

Highlighted
Super User II
Super User II

Re: Get List Items problem

Hi @Anonymous 

 

The issue is that, when you do the formatDate, you're converting the result to a string, so you're comparing a String with a Date. You should keep the uctNow(), and since both are dates, then you'll be able to make the comparison.

 

Also, you can make a comparison when you fetch the items so that you get fewer items. To achieve that here's an example:

small-Screenshot_2020-01-03_at_10_16_17.jpg

 

Please don't forget the "x0020" since there's a space between Due Date.

 

If I have answered your question, please mark your post as Solved.
If you like my response, please give it a Thumbs Up.

Cheers
Manuel

View solution in original post

Highlighted
Anonymous
Not applicable

Re: Get List Items problem

Hi Jay

Thanks so much for your help in the previous issue it is now solved thanks to you. But now I need your help with another issue. As my flow is re reccurring at 8am every morning I expect it to send me one email of each action that is due. However when I checked this morning I noticed it sent me 2 sets of the due actions.
Here is an example. The List items I highlighted in red are the items im supposed to receive an email for, so in total 3 emails. However it sends me 6 emails repeating each item twice and im not sure why.

Due actions.png

Here is a picture of my condition which I suspect may be the problem

 

Condition.png

Any help would be greatly appreciated 🙂

Highlighted
Super User II
Super User II

Re: Get List Items problem

Hi @Anonymous 

We should really start a new issue in a new thread to make sure other users can easily find similar solutions to similar challenges.

I expect the issue is because you have the 'Send Email' action embedded within another 'Apply to Each' loop.

Can you remove this second loop?

HTH

Jay

 

Highlighted
Anonymous
Not applicable

Re: Get List Items problem

Hi Jay, sure, I have just created a new thread here is the Link .

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 (8,515)