cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
PeterBurton
New Member

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".

6 REPLIES 6
RajRa
Power Automate
Power Automate

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
New Member

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?

 

 

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

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. 

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.

Dran
Regular Visitor

power automate is a hell, only exist because big corporatons use office365. You think, if it would be a startup, any one would buy it?

Helpful resources

Announcements
Power Platform Conf 2022 768x460.jpg

Join us for Microsoft Power Platform Conference

The first Microsoft-sponsored Power Platform Conference is coming in September. 100+ speakers, 150+ sessions, and what's new and next for Power Platform.

New Ideas Forum MPA.jpg

A new place to submit your Ideas for Power Automate

Announcing a new way to share your feedback with the Power Automate Team.

MPA Virtual Workshop Carousel 768x460.png

Register for a Free Workshop

Learn to digitize and optimize business processes and connect all your applications to share data in real time.

MPA Licensing.jpg

Ask your licensing questions at the Power Automate AMA!

Join Priya Kodukula and the licensing team, super users and MVPs to find answers to your questions on Power Automate licensing.

Users online (1,876)