cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Helper I
Helper I

How to remove For Each

I'm using the OOTB Flow reminder and I am adding some extra action after the condition, for example an email and a post in a Team, however every time I add an action Flow automatically adds the For Each.

I don't want to use it because it sends multiple emails or multiple posts (based on the output Value from the Get Items), I only want one single action after the condition is met.

Can this be done?

 

Flow-ForEach.JPG

1 ACCEPTED SOLUTION

Accepted Solutions
Highlighted
Super User III
Super User III

Re: How to remove For Each

Hi @Mikele- ,

 

I have tried a similar flow like yours. First added get items and added a conditional step. Under the no condition I have added the email and post message without the loop. You must have clicked the wrong add action flow step.

 

Please see below.

 

P89.png

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials

View solution in original post

8 REPLIES 8
Highlighted
Super User III
Super User III

Re: How to remove For Each

Hi @Mikele- ,

 

Get Items returns more than one records and this is by design.

 

Can't you set the 'Top Count' number to 1 in your Get Items flow step?

 

Believe still it will add the foreach loop but the record count is limited to 1 only.

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials
Highlighted
Helper I
Helper I

Re: How to remove For Each

Well I actually noticed that the email action seems to be smart enough to aggregate the results (by using the TableRows variable?), in this example Value returns 4 items.

But when I try to use the same TableRows in the Post message in Teams, it actually creates 4 posts

 

Flow-ForEach2.JPG

 

Flow-ForEach4.JPG

 

Flow-ForEach3.JPG

 

Flow-ForEach5.JPG

Highlighted
Super User III
Super User III

Re: How to remove For Each

Hi @Mikele- ,

 

Thanks for your reply.

 

Why you got  Post a message in a for each loop? Is this added by default by the flow? This is the reason it is sending multiple posts. Try remove the foreach loop and add a new flow step Post message after Send an email notification step.

 

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

 

Thanks

 



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials
Highlighted
Helper I
Helper I

Re: How to remove For Each


@abm wrote:

Hi @Mikele- ,

 

Thanks for your reply.

 

Why you got  Post a message in a for each loop? Is this added by default by the flow? This is the reason it is sending multiple posts. Try remove the foreach loop and add a new flow step Post message after Send an email notification step.

 


@abm Yes that was my problem: when I added an action in the branch condition  (an email or Teams post), Flow automatically creates a loop for it, I guess because the returned value of the Get Items is an array. 

But somehow I was now able to take the actions out of the loop

 

Highlighted
Super User III
Super User III

Re: How to remove For Each

Hi @Mikele- ,

 

I have tried a similar flow like yours. First added get items and added a conditional step. Under the no condition I have added the email and post message without the loop. You must have clicked the wrong add action flow step.

 

Please see below.

 

P89.png

If this reply has answered your question or solved your issue, please mark this question as answered. Answered questions helps users in the future who may have the same issue or question quickly find a resolution via search. If you liked my response, please consider giving it a thumbs up.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials

View solution in original post

Highlighted
Helper I
Helper I

Re: How to remove For Each

 
Highlighted
Super User III
Super User III

Re: How to remove For Each

Hi @Mikele- 

 

Did you resolved this? Can't see any update from your last reply.

 

Thanks



Did I answer your question? Mark my post as a solution!

If you liked my response, please consider giving it a thumbs up


Proud to be a Flownaut!

Learn more from my blog

Power Automate Video Tutorials
Highlighted
Helper I
Helper I

Re: How to remove For Each

Hi @abm thanks for the follow. I was posting that I was having the same issue with Flow adding a loop when I add an action, but I think what is happening I think that it does that when you pick a dynamic value that is associated to a previous action that returned an array, which I think makes sense

Some other posts referring to the same isse: link, link

Helpful resources

Announcements
Community Conference

Power Platform Community Conference

Check out the on demand sessions that are available now!

Power Platform ISV Studio

Power Platform ISV Studio

ISV Studio is designed to become the go-to Power Platform destination for ISV’s to monitor & manage published applications.

Upcoming Events

Experience what’s next for Power Automate

See the latest Power Automate innovations, updates, and demos from the Microsoft Business Applications Launch Event.

Top Solution Authors
Top Kudoed Authors
Users online (6,572)