cancel
Showing results for 
Search instead for 
Did you mean: 
Reply
Highlighted
Mikele-
Level: Powered On

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
Super User
Super User

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!



View solution in original post

8 REPLIES 8
Super User
Super User

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!



Mikele-
Level: Powered On

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

Super User
Super User

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!



Mikele-
Level: Powered On

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

 

Super User
Super User

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!



View solution in original post

Mikele-
Level: Powered On

Re: How to remove For Each

 
Super User
Super User

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!



Mikele-
Level: Powered On

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
firstImage

Power Platform Online Conference

Speakers, submit your sessions now! Call for speakers ends Feb. 10!

firstImage

New & Improved Power Automate Community Cookbook

We've updated and improved the layout and uploading format of the Power Automate Cookbook!

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 Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (4,858)