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 / Sending emails to diff...
Power Automate
Suggested Answer

Sending emails to different outputs from a "for each" step

(0) ShareShare
ReportReport
Posted on by 103
Hello,
 
I'm currently working on a requirement to send a reminder email to the purchase order requester. My flow looks at the requested receipt date and collects the requester worker ID from that PO, which it then uses to get their work email address in a "for each" step
 
 
This all works fine, in my test I have 2 worker email addresses brought back from the POs.
 
My question is, how do I send the email for the correct PO to the correct worker?
 
i.e.
 
PO 1 - Requester is Worker A - Email to Worker A
PO 2 - Requester is Worker B - Email to Worker B
 
As I don't seem to be able to input anything dynamic in the "To" field of the email
 
 
Thanks,
Michael
Categories:
I have the same question (0)
  • Tomac Profile Picture
    4,105 Moderator on at
    Are you sending the emails from within the Apply To Each (named For Each in your example)? You won't have access to the values from within the Apply To Each while outside of it.
     
    Either store the data in a variable (I'd recommend an array containing the PO and the email address) to use in a secondary Apply To Each, or use the Send An Email action inside of the Apply To Each loop.
  • Building with Why Profile Picture
    351 Moderator on at
    Each PO has a single requestor or multiple requestors?   Is the requestor a lookup column or text?  You can simplify your flow if it is a lookup for a single requestor.
     
    Without changing your flow click the gear to use dynamic content.  HOWEVER, it looks like you are using a List rows for your email as well so that will trigger a nested For Each.  If there is only a single requestor this is not desired.
    you can use the following expressionin the dynamic content to avoid the For Each:
    outputs('List_Requesters_Work_Email_Address')?['body/value']?[0]?['{email field}']
  • MBates237 Profile Picture
    103 on at
    @Building with Why Each PO has a single requestor, however, each run may have multiple POs as it is getting all POs with today as the requested receipted date. I think if I did what you're suggesting, I would only get the requestor from the first PO in the run?
  • Building with Why Profile Picture
    351 Moderator on at
    your step to get requestor's email is inside a For Each associated with the PO you are sending the email.  As long as you send the email inside the For Each it will only send 1 email but it will be the email for that specific PO. 
     
    Each time the For Each loop runs a new email will be sent. 
     
    There are ways to group the emails together so the each requestor only gets one email.  (See @Tomac response below) This method could result in a requestor getting multiple emails.
  • Suggested answer
    Tomac Profile Picture
    4,105 Moderator on at
    Here's a quick and dirty sample flow to accomplish your goal with only sending one email per requestor. This uses an Excel table as the data source, so adjust to your environment:
     
     
    And here's the data source I'm using:
     
    This should give you what you need to build your Flow.
     
     

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 April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 801

#2
Valantis Profile Picture

Valantis 602

#3
Haque Profile Picture

Haque 581

Last 30 days Overall leaderboard