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 / Turn off Apply to Each...
Power Automate
Answered

Turn off Apply to Each to prevent multiple emails being sent to recipient

(0) ShareShare
ReportReport
Posted on by Microsoft Employee

Hi, 

 

I have the following Flow:

 

When an email arrives in the shared mailbox with a particular ID from a client, a log is created in SharePoint for the incoming request (Request Log List), then SharePoint checks the Agent List on SharePoint to see who the ID belongs to and then sends an email notifying the agent whose email got autopopulated on the Request Log List responsible for the ID. Here is what the flow looks like:

 

ops_geo_0-1669674269573.png

 

The problem is, the agent is getting multiple emails for ids they are not even responsible for and I suspect it is because of that apply to each function, so I hoping someone can help me find a solution so that agents get only 1 email for the ID they are responsible for only.

 

PS: the incoming emails from the clients contain a PDF file (not sure if this information is helpful but I just wanted to mention that)

 

Thank you

Categories:
I have the same question (0)
  • Ed Gonzales Profile Picture
    4,531 Most Valuable Professional on at

    @Anonymous 

    Hey there - You're right (from what I can tell)...Because you used the step "Get Items" (note the plural), it is getting everything on that SP List, then cycling through it all.

     

    If you only want the details of that one thing, see if Get Item by ID will work (hard to tell without seeing the rest of the flow), that will return a single row.

     

    Keep us posted.

    -Ed

     

    If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

  • Community Power Platform Member Profile Picture
    Microsoft Employee on at

    @edgonzales 

    I tried Get Item with ID but it did not work. Here is my complete flow:

    ops_geo_0-1669678263039.png

     

    ops_geo_1-1669678374686.png

     

    ops_geo_3-1669678587426.png

     

     

     

  • Ed Gonzales Profile Picture
    4,531 Most Valuable Professional on at

    So the Get Items step, does it have a filter on it to match the ID from the email to the ID in the SP list?  You'll want to have that in place...and then I presume that each ID is only in the SP list one time, right?

     

    Even if the results are only 1 item long, Power Automate is still treating it as a list since that is the expected output of that step.  You can avoid the loop by wrapping the result in something like a first()...check out Elaiza's video here:

    Then, you can move onto your Send email step without having a loop.

     

    Good luck,

    -Ed

     

    If you liked this reply, please give it a thumbs up! If this reply has answered your question or resolved your challenge, please consider marking it as a Solution. This helps other users find it more easily via search.

  • Verified answer
    Community Power Platform Member Profile Picture
    Microsoft Employee on at

    hi everyone,

     

    I was able to solve this issue, so after the Get Items action, I added an initialize variable function to prevent the "Apply to each" action from happening, here is what the middle step I added after Get Items:

    ops_geo_0-1669691728294.png

     

    And then, instead of directly taking the email address from the SharePoint List, I took it from the initialize variable and it worked! Hopefully my solution helps anyone in the same boat as me 🙂

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!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 592

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard