Skip to main content

Notifications

Power Automate - Building Flows
Unanswered

Dealing with 'apply to each' and not nesting beyond the 8 level limit

(0) ShareShare
ReportReport
Posted on by 2
Hi Power Platform Team,
 
I am struggling with the 'apply to each' action being added into my flow. 
 
I have a list and several 'list forms' to capture information for people requesting training, learning consultations, projects etc. (an L&D team). See image of flow attached. I have built this exact type of request system before but this time I have 2 fields with multiple selections turned on - the learner name(s) and the how the training need was identified. Both fields could be a single response or could be multiple and I want to allow for this. 
 
When I start adding the data in the first approval I immediately get these 'apply to each' things added and the approval is nested under.
I have this 'apply to each' for the following fields on each approval and email:
Learner(s)
Training need identification
Manager approval comments
Director approval comments
L&D approval comments
SLT approval comments
 
The problem here is that I have 4 approvals (each to a different level of manager) and after each approval I email the requestor and managers approving for their records. So every approval and every email is getting from 2-5 'apply to each' functions.
 
The data down the tree only lets me select the original field (learner name(s)) which just creates another 'apply to each' and my nesting issue presents, or I can select the 'current' item from the previous 'apply to each' but from my understanding that will only give me 1 name not all that are submitted in the form. I either exceed the nesting limit of 8 and have 'apply to each' functions absolutely everywhere and get a logic error and can't save or I only get 1 name from a potentially multi name field. I also get this 'apply to each' when I add the 'responses comments' field from an approval into an email or update the list. No idea why this would produce an 'apply to each' when it's a text field. 
 
Is there a way to avoid this or better control these? I'm really hoping there is a simple solution.
 
Thanks.
 
  • sroo Profile Picture
    sroo 890 on at
    Dealing with 'apply to each' and not nesting beyond the 8 level limit
    Could this be a solution?
     
    If you initialize variable array, add the data you need form the apply to each (append to array), then in a separate apply to each under it you perform the action you need with the data in the created array. That way you can avoid some of the nesting.  
  • TR-12010518-0 Profile Picture
    TR-12010518-0 2 on at
    Dealing with 'apply to each' and not nesting beyond the 8 level limit
     
    I have seen this and like a lot of tutorials it only talks about removing the loop by having only 1 output. That defeats the entire point, I want to get all the names entered not 1 of them (first or last).
     
    Would love to figure out how. Only way I can think of is splitting the flow into 4 different flows so the nesting doesn't go over 8. 
  • VictorIvanidze Profile Picture
    VictorIvanidze 11,859 on at
    Dealing with 'apply to each' and not nesting beyond the 8 level limit

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Microsoft Kickstarter Events…

Register for Microsoft Kickstarter Events…

Announcing Our 2025 Season 1 Super Users!

A new season of Super Users has arrived, and we are so grateful for the daily…

Announcing Forum Attachment Improvements!

We're excited to announce that attachments for replies in forums and improved…

Leaderboard

#1
WarrenBelz Profile Picture

WarrenBelz 145,580

#2
RandyHayes Profile Picture

RandyHayes 76,287

#3
Pstork1 Profile Picture

Pstork1 64,909

Leaderboard