Skip to main content

Notifications

Power Automate - Building Flows
Suggested answer

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

Like (0) ShareShare
ReportReport
Posted on 14 Jan 2025 16:48:25 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!
 
  • 98-911 Profile Picture
    98-911 43 on 15 Jan 2025 at 13:49:03
    How can I eliminate "apply to each" when adding dynamic content to Send Email
     
    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!
  • Suggested answer
    David_MA Profile Picture
    David_MA 8,219 on 14 Jan 2025 at 19:51:16
    How can I eliminate "apply to each" when adding dynamic content to Send Email
    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
    98-911 43 on 14 Jan 2025 at 17:59:15
    How can I eliminate "apply to each" when adding dynamic content to Send Email
     
    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
    David_MA 8,219 on 14 Jan 2025 at 16:58:56
    How can I eliminate "apply to each" when adding dynamic content to Send Email
    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.

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

End of Year Newsletter…

End of Year Community Newsletter…

Tuesday Tip #12 Start your Super User…

Welcome to a brand new series, Tuesday Tips…

Tuesday Tip #11 New Opportunities…

Welcome to a brand new series, Tuesday Tips…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 144,609

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,420

Leaderboard
Loading started