cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Mikele-
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

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 blogPower Automate Video Tutorials

View solution in original post

8 REPLIES 8
abm
Super User
Super User

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 blogPower Automate Video Tutorials

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

abm
Super User
Super User

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 blogPower Automate Video Tutorials


@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

 

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 blogPower Automate Video Tutorials

View solution in original post

 

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 blogPower Automate Video Tutorials

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
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!

Welcome Super Users.jpg

Super User Season 2

Congratulations, the new Super User Season 2 for 2021 has started!

Carousel 2021 Release Wave 2 Plan 768x460.jpg

2021 Release Wave 2 Plan

Power Platform release plan for the 2021 release wave 2 describes all new features releasing from October 2021 through March 2022.

Top Solution Authors
Users online (1,434)