Stop Power Automate from Adding an Apply To Each

Maybe you’ve occasionally experienced the same sensation I have when working in Power Automate – saying out loud to your screen, “WHY DOES IT DO THAT?!” For me, one of these such features is the automatic addition of an “Apply to Each” container in your action – in my case, a “send email” action. This happens each time I add a People Picker multi-select field from my SharePoint list to the body of my email. Initially I thought this was a result of the field being an array (a field that has several elements), however, it only occurs if the field allows multi-select.

Want to see the steps in action? Check out our YouTube video that takes you through the steps outlined below.

With a  bit of investigation, I found a great solution by initializing and setting variables in my Power Automate, prior to the Send Email action.

Here’s what my Flow looks like:

image

 

Once you insert the Initialize variable action followed by the Set Variable action and set it to the Project Manager display name, that variable will then become available in your Send Email action:

image

An additional, added benefit of this is that if your list had many multi-select people picker fields, all of which you wanted to add to the body of an email, creating variables for each of them in the Power Automate first would prevent nested “Apply to each”s from being created for your single email action. Much tidier!

 

Good luck!

 

Learn more about Power Automate on our Power Platform and Reporting page
Check out our helpful M365 videos 
Reach out to info@ppmworks.com for any questions