cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PeterBurton
Level: Powered On

Stop Flow Adding for Each Container

Hello,

 

I have created a Flow that pulls a number of records from a SQL query.  I then use a

 

I wish to send a seperate email for each of these rows based on criteria so I place a for each around this.  I then go to send an email, and wish to include a field from the SQL query inside this email.

 

When I add result from the query to the body of my send mail action Flow attempts to be helpful and automatically addss a "for each" container.  I do NOT want a for each container. 

 

This caused there to be a for each container INSIDE another for each, which is not allowed. 

 

I seemingly have no options to change this.  Please allow me to change this or to turn off this auto change "feature".

5 REPLIES 5
Highlighted
Power Automate Staff RajRa
Power Automate Staff

Re: Stop Flow Adding for Each Container

Hi Peter,

 

You can always drag the actions from the 2nd for each into the first (and then remove the second for each). It looks like that is what you intend to do

 

For each is added automatically becuase the results from the previous action is a collection of results, so it would need to be there 

msaynez
Level: Power Up

Re: Stop Flow Adding for Each Container

I am having the same issue, this is my situation.

 

When a file is created or modified (properties) in a SharePoint library, send an email with options.

 

Inside the body of the email is a table with a list of the document properties (site columns associated in a Content Type) as populated by the creator of the file.

 

I have added a table in the body of the email via html code to present names and values stored to the user. The values are added using "Add dynamic content", everything goes well until I need to add a site column that is Choice Option with checkboxes (allow multiple selections).

 

What I want Flow to do is JUST list the checked values, instead it adds the For Each container and everything goes to hell because there is no way to avoid this behavior. I have tried to drag the Send Email container from the For Each with no luck.

 

Se below, in the field "Content Category" I just want to list the checked options Documentaries, Sports, Music, but what Flow will do is add the For each container and then send one email with Documentaries, another with Sports and yet another one with Music. I just want one email with all the checked options, furthermore, if I add another column of the same type, it will add another For Each Container.

 

Contract Sumary
Contract NameContract Sample Document
Contract TypeMaster Agreement
Contract Start Date4/20/2018
License Period03 Months
Content CategoryDocumentaries, Sports, Music

 

Can this behavior be avoided or worked around? Only answer that I am thinking of is to change the type to a simple text box and let the creator fill the info, but this defeats my purpose of diminishing input errors and increasing productivity.

 

Anyone?

 

 

JojenReed
Level: Powered On

Re: Stop Flow Adding for Each Container

Me too! I followed the guidance from the link below, which has a "data operations - select" statement that is NOT part of a for each loop. I saved it, it worked fine, then I went back in to tweak it. Now it is wrapping a foreach loop around my select stage and the flow is now broken.

 

Whenever I try to delete the select stage and re-insert it, the foreach loop strikes every time.

 

The foreach loop didn't materialise the first time i created my flow, it didn't materialise for the person who created the flow in the link below, how can I stop it materialising?

 

https://powerusers.microsoft.com/t5/Building-Flows/Monthly-email-with-info-about-new-items-in-SP-lis...

 

Anonymous
Not applicable

Re: Stop Flow Adding for Each Container

I am having the same issue. I am trying to create a Planner Task when a new item is added to a SharePoint list. I am populating the Assigned User ID column with a people picker field that allows multiple selection. As soon as I add that dynamic content it adds the For Each container. I cannot move the Create a Task action out of it once Flow creates it. 

rgbrasel
Level: Powered On

Re: Stop Flow Adding for Each Container

I have a flow that generates three separate emails. Now Flow decides, arbitrarily, that the last one needs to be in a foreach loop. There's no output, and now I have to get rid of it, recreate my email, and hope that Flow doesn't decide to encapsulate the step in a loop. 

 

I cannot fathom the confusion of ideas that led the development team (or some clueless manager) to think that allowing the software to automatically create loops without any user input was in any way, shape, or form a good idea. The software's not good enough to make predictive decisions--especially when it comes to logical structures or loops.

Helpful resources

Announcements
thirdimage

Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!

firstImage

Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!

fifthimage

Microsoft Learn

Learn how to build the business apps that you need.

sixthImage

Power Platform World Tour

Find out where you can attend!

seventhimage

Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Kudoed Authors (Last 30 Days)
Users online (4,628)