Showing results for 
Search instead for 
Did you mean: 
Kudo Kingpin
Kudo Kingpin

This output is an array. A foreach cannot be nested inside of another foreach.

I have a business requirement where for each salesforce user I need to get all opportunities closed today and send combined single email to each user combining multiple closes opportunities per user using compose function.

when I try to do it it says This output is an array. A foreach cannot be nested inside of another foreach.




For each salesforce user every night get all closed opportunities (close date as today) and combine those closed opportunities in a single email(per user) and send email to each user(with a list of closed opportunities with date)


How to do this?

I tried using get salesforce users and then for each get opportunities with close date as today (I can not add second condition where owner id is for each user)

Community Support
Community Support

Hi AmitLoh,


It seems that your requirement cannot be achieve directly with only one Flow process, please try to separate them and create 2 flows to see if this works.


Best regards,

Mona Li


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

I am trying this as well. It seems to be tricky to do it in 2 seperate workflows as I need to get user specific closed opps. data then combine and send email to each user.

New Member



I'm facing similar issue i.e. This output is an array. A foreach cannot be nested inside of another foreach.


can you please let me know how you handled this issue.


your inputs are highly appreciated.




Any update on this how it was solved? Any input/help will be highly appreciated. This is what I'm doing:


- getting rows from sql table 

- foreach for each row and then use text speach to get key phrases

- once i have these key phrases whcih are array, i need to insert into a table


since I'm unable to add foreach loop in other foreach, is there way that I can make this array a string and then insert into a table?


Not sure what is the right solution but any help will be great.




Another "broken by design" Office 365 feature.

Helpful resources

UG GA Amplification 768x460.png

Launching new user group features

Learn how to create your own user groups today!

Community Connections 768x460.jpg

Community & How To Videos

Check out the new Power Platform Community Connections gallery!

M365 768x460.jpg

Microsoft 365 Collaboration Conference | December 7–9, 2021

Join us, in-person, December 7–9 in Las Vegas, for the largest gathering of the Microsoft community in the world.

Top Kudoed Authors
Users online (1,459)