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 / Create variable from m...
Power Automate
Unanswered

Create variable from multiple person field for email

(0) ShareShare
ReportReport
Posted on by

Hi folks, I've been going through the discussions relating to my topic but am still stumped, hoping someone can please make this super simple for me because I'm just not getting it 🙂

 

I have a flow that needs to run daily, it will collect all items from a SharePoint list and if the conditions are correct, it needs to send an email to a list of people in a multi-choice people column. It's this that's stumping me! I know I need to set it up into a variable but every time I try, it puts it into an 'apply to each' then complains that it can't do that.

 

Flow save failed with code 'InvalidVariableInitialization' and message 'The variable action 'Initialize_variable' of type 'InitializeVariable' cannot be nested in an action of type 'Apply_to_each_2'.'.

 

Can someone please explain a workaround for this 🙂

Categories:
I have the same question (0)
  • JonDoesFlow Profile Picture
    1,304 on at

    Hi,

     

    Why not just reference the email address field in the Send an Email action, and that will put it into an apply to each and the emails can be sent that way ? Does the email have to be in a variable ?

     

    Jondoesflow_0-1655813456842.png

    Please mark this as a solution if I have helped solve you issue.

     

  • Community Power Platform Member Profile Picture
    on at

    Hi Jondoesflow, I tried that first and it fails:

    ExpressionEvaluationFailed. The execution of template action 'Apply_to_each_6' failed: the result of the evaluation of 'foreach' expression '@items('Apply_to_each')' is of type 'Object'. The result must be a valid array.

  • JonDoesFlow Profile Picture
    1,304 on at

    Ensure that you only have one apply to each like I have in my screenshot, and inside that apply to each is just the send an email action, I also had this error, but it was because I was initializing a variable in another apply to each, as soon as I got rid of that, this worked.

  • Community Power Platform Member Profile Picture
    on at

    Hi Jondoesflow, even with a single apply to each it still fails, I tried making a new Flow to test this out.

     

    The execution of template action 'Apply_to_each_2' failed: the result of the evaluation of 'foreach' expression '@items('Apply_to_each')' is of type 'Object'. The result must be a valid array.

  • JonDoesFlow Profile Picture
    1,304 on at

    Hey @Anonymous can you provide some screenshots please?

  • Community Power Platform Member Profile Picture
    on at

    Hi Jondoesflow, certainly!

     

    I've added screenshots from my test.

    1.jpg

    2.jpg

    3.jpg

  • Community Power Platform Member Profile Picture
    on at

    I'm trying to imitate one I've set up previously (trigger was on item creation rather than daily schedule) but again, can't quite work it out!

     

    6.jpg7.jpg

  • Verified answer
    v-bofeng-msft Profile Picture
    on at

    Hi @Anonymous ,

     

    Please try:

    vbofengmsft_0-1655970562195.png

     

    Best Regards,

    Bof

     

  • Community Power Platform Member Profile Picture
    on at

    Thank you Bof that has worked!!

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 462 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 456 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard