web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Error: Action 'Apply_t...
Power Automate
Unanswered

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

(0) ShareShare
ReportReport
Posted on by 6

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?view=o365-worldwide

 

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.

Categories:
I have the same question (0)
  • Sundeep_Malik Profile Picture
    6,484 on at

    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.

  • hovanviet1292 Profile Picture
    6 on at

    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 Profile Picture
    6,484 on at

    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 Profile Picture
    6 on at

    Hi @Sundeep_Malik ,

     

    I followed for guide, but the issue still occur. 

    hovanviet1292_0-1663311618143.png

     

  • hovanviet1292 Profile Picture
    6 on at

    Can someone help me?

  • Sundeep_Malik Profile Picture
    6,484 on at

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

    @Pstork1 

  • v-liwei-msft Profile Picture
    Microsoft Employee on at

    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

  • Pstork1 Profile Picture
    69,018 Most Valuable Professional on at

    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

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 67

#2
David_MA Profile Picture

David_MA 64 Super User 2026 Season 1

#3
Expiscornovus Profile Picture

Expiscornovus 39 Most Valuable Professional

Last 30 days Overall leaderboard