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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / How can I eliminate "a...
Power Automate
Suggested Answer

How can I eliminate "apply to each" when adding dynamic content to Send Email

(0) ShareShare
ReportReport
Posted on by 43
I have a flow that works properly as is, however I want to change the "send an email v2" section to include dynamic content.  I am getting information from a SharePoint list.  I want to add the dynamic content "created by" as the to email address and the dynamic content "master ID" to the subject line.  When I add either one, it injects "apply to each" which I do not want.  What can I do to get around this?  Below is my flow as is, that works.  Thank you!
 
Categories:
I have the same question (0)
  • Suggested answer
    David_MA Profile Picture
    12,982 Super User 2025 Season 2 on at
    I am not 100% sure what you are doing, but based on the Filter array action, I think you have actions above what you show from a SharePoint list that contains the value MasterID, which corresponds to an ID in another SharePoint list which you use in the Get items action. 
     
    If this is accurate, delete the Get items action (plural), replace it with a Get item action (singular). Use the value of the MasterID in the ID field of the Get item action. This way, you are returning just one row of data, and the flow will not put your actions into an Apply to each.
  • 98-911 Profile Picture
    43 on at
     
    You are correct, I am filtering from 2 SharePoint lists.  SharePoint list 1 contains the value ID and SharePoint List 2 contains the value MasterID and they have to match.  See below for that part of my flow.  If I were to remove Get Items (plural) and replace with Get Item (singular) how do I filter the items to only process when MasterID is equal to ID?  I tried to do what you outlined and the From in filter array is looking for a value and I no longer have an array.  Do I eliminate the Filter array and if so, how do I make this part work?
     
    Thank you very much!
     
     
     
  • Suggested answer
    David_MA Profile Picture
    12,982 Super User 2025 Season 2 on at
    This is not exactly the same as what you are doing, but the concept is. Let me explain what I do, and then you should be able to apply it to what you are doing:
    1. When an item is submitted in a SharePoint list, the requester chooses a value from a lookup field (this would be your MasterID, which is WFRoutingID in my list).
    2. This lookup list contains a people field with the name(s) of the people the request needs to be assigned to.
    3. When the flow runs, it uses a Get item action based on the ID of the selected value.
    4. I then use an Append to string variable to set the variable for the assignees with the e-mail addresses from the Get item that is returned.

     
    Note: In the above image, I don't really use the WFRoutingID from the trigger and the crossed off action is irrelevant to you. I use a coalesce expression instead. This ensures that if the trigger value is null, a correct value is returned. For the ID, I use this expression which returns the value from the trigger, and if it is null, it returns a default value of 1: coalesce(int(triggerOutputs()?['body/WFRoutingID']),1) 
     
    The item in the list with the ID of 1 ensures the e-mail goes to the folks who handle the errors in the process.
     
  • 98-911 Profile Picture
    43 on at
     
    Thanks again for your response.  I am not following your example and not sure how to incorporate it into my flow.   My ID and Master ID are on 2 separate lists and need data to be emailed based on those values being the same.  Going back to basics, it works flawlessly the way I have it, but as soon as I try to add dynamic content to my email it wants to apply to each and then sends multiple emails.  I am not an expert by any means, I just know enough to do simple flows.  I do appreciate your help!

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 519 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 296 Moderator

#3
abm abm Profile Picture

abm abm 232 Most Valuable Professional

Last 30 days Overall leaderboard