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

Error: Action 'Apply_to_each' failed when run Flow Alert onboard MDATP

Hi all,

 

I created a auto flow to send mail alert when has new Devices onboard Microsoft Windows MDATP, refer link: https://docs.microsoft.com/en-us/microsoft-365/security/defender-endpoint/onboarding-notification?vi...

 

But at 4 step "Apply_to_each" has error "Action 'Apply_to_each' failed". 

Error details:

Unable to process template language expressions for action 'Apply_to_each' at line '0' and column '0': 'The number of foreach items limit exceeded for action 'Apply_to_each': maximum '5000' and actual '5794'.'.

hovanviet1292_0-1663299002301.png

Please help me fix.

8 REPLIES 8
Sundeep_Malik
Community Champion
Community Champion

Hey @hovanviet1292 

Not sure but with different licenses you can get more items from get items.

Try some workarounds:

  • Go to settings of get items and open the option of pagination and increase threshold from 5000 to 6000.Sundeep_Malik_0-1663300726985.png

     

  • If the above didnt work try to decrease the items by adding something in filter query of get items.
  • If 2nd method also didnt work, use two get items, in first get items give top count as 5000, and in the second get items, give skip count 5000.

 

I hope these steps help.

Hi @Sundeep_Malik ,

 

Thanks for your support,

 

I am new member, i tried follow 1 method but my license cannot change to 6000.

with 3nd method, how to create 2 get items.

Sundeep_Malik
Community Champion
Community Champion

Hey @hovanviet1292 

just use them in parallel.

Click the plus icon.

Sundeep_Malik_0-1663303843485.png

Sundeep_Malik_1-1663303873362.png

So, in the first in top count give 5000, in the second get items in order by, do it in descending order and in top count give rest of the items.

[My bad there is not skip option in this, it was there in list rows in a table for onedrive excel.]

hovanviet1292
Regular Visitor

Hi @Sundeep_Malik ,

 

I followed for guide, but the issue still occur. 

hovanviet1292_0-1663311618143.png

 

hovanviet1292
Regular Visitor

Can someone help me?

Sundeep_Malik
Community Champion
Community Champion

@v-liwei-msftIs it fine, me tagging you in so many posts?

@Pstork1 

v-liwei-msft
Community Support
Community Support

Hi @Sundeep_Malik @hovanviet1292 

 

I think your method is great! 

I'm just adding a little addition to your method (your method is probably the most perfect).

You can display the ID column in the SharePoint list and turn on the count (so you can see how many items are in the list to avoid getting duplicates in two get items in parallel.)

vliweimsft_0-1663749693024.jpeg

vliweimsft_1-1663749705455.png

Also, as Sundeep_Malik said, upgrading your license is a great way too!

 

Best Regards,

Levi

Apply to each loops are limited to a maximum of 5,000 items if you are on the Office 365 seeded license or Power Automate free.  The per user license allows loops of up to 100,000 items.  If you need to process more than 5,000 items in a loop you should upgrade to a paid license.  This article outlines the limits.

Limits and configuration - Power Automate | Microsoft Learn



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

Helpful resources

Announcements
Power Automate News & Announcements

Power Automate News & Announcements

Keep up to date with current events and community announcements in the Power Automate community.

Community Calls Conversations

Community Calls Conversations

A great place where you can stay up to date with community calls and interact with the speakers.

Power Automate Community Blog

Power Automate Community Blog

Check out the latest Community Blog from the community!

Top Solution Authors
Users online (1,588)