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 / Error on my flow Initi...
Power Automate
Answered

Error on my flow Initialize_variable

(0) ShareShare
ReportReport
Posted on by 504
The variable action 'Initialize_variable' of type 'InitializeVariable' cannot be nested in an action of type 'Apply_to_each'.

I am getting that error when ever i test my flow, can someone please help me?

I am getting a list from sharepoint where status = pending
And I will group all user email to avoid one user receiving multiple emails.
 
 
 
 
 
 
 

Untitled.png

 

Categories:
I have the same question (0)
  • Verified answer
    v-alzhan-msft Profile Picture
    Microsoft Employee on at

    Hi @nagestiada ,

     

    Please refer to screenshot below to create the flow:

    1.png2.png

     

    Best Regards,

    Alice

     

    Community Support Team _ Alice Zhang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • nagestiada Profile Picture
    504 on at

    @v-alzhan-msft 

    I am getting an error at compose 2 in union, Unable to process template language expressions in action 'Compose_2' inputs at line '1' and column '2829': 'Template language function 'union' expects parameters of same type, but found 'Array,Integer' distinct types.'.

    union(variables('emails'),outputs('Email'))

     

  • v-alzhan-msft Profile Picture
    Microsoft Employee on at

    Hi @nagestiada ,

     

    Take a try with expression below:

    union(variables('emails'),array(outputs('Email')))

     

    Best Regards,

    Alice

     

    Community Support Team _ Alice Zhang
    If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.

  • nagestiada Profile Picture
    504 on at

    @v-alzhan-msft It worked, Thanks! by any chance do you know this error: "You are not authorized to perform this operation. This error can occur for sandbox (test) accounts or if OData operations are disabled by your Exchange server administrator."

    Does it mean i don't have access to the shared mailbox even if i can send and received using that mailbox on my outlook?

  • nagestiada Profile Picture
    504 on at

    @v-alzhan-msft  when I use the current Item on send an email I get this error: The template validation failed: 'The inputs of template action 'Send_an_email_(V2)' at line '1 and column '1639' is invalid. Action 'Apply_to_each_3' must be a parent 'foreach' scope of action 'Send_an_email_(V2)' to be referenced by 'repeatItems' or 'items' functions.'.

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 785

#2
Valantis Profile Picture

Valantis 669

#3
Haque Profile Picture

Haque 563

Last 30 days Overall leaderboard