web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / "apply to each" within...
Power Automate
Answered

"apply to each" within another "apply to each"

(0) ShareShare
ReportReport
Posted on by 54

Hi,

 

I've been experimenting Microsoft flow to initiate an approval request on a sharepoint list submission.

Have encountered many challenges, redesigned the flow and feel i'm the right direction until i hit a barrier which had put me on a hold. I've looked at many discussions thread around here however none was able to help.

 

Below is the process of my flow that I have summarize to the challenge faced.

 

I have an array of items.

[
  "DepartmentA->DeptAOwnerEmail",

  "DepartmentB->DeptBOwnerEmail",

  "DepartmentC->DeptCOwnerEmail",

  "DepartmentD->DeptDOwnerEmail"
]

 

1. used "Apply to each" & item() to extract data from array: GOOD

"DepartmentA->DeptAOwnerEmail"

 

2. using split command, i extracted data into another array(just 2 items per array): GOOD

 

Example:

[
  "DepartmentA",

 

  "DeptAOwnerEmail"
]

 

3. Now the challenge I have is using the Array(output) and passing it on to another "Apply to each" loop

 

The reason I'm doing this is because I am trying to set an initialized variable with the output from here which will be used in a later part of the flow.

 

dept = "DepartmentA"

deptowner = ""DeptAOwnerEmail"

 

in theory, if initial array consists of 4 items, there will be 4 sets of dept & deptowner.

within the loop itself, an approval request will be made using data from above. Initial array value depends on the data on the sharepoint list itself, ranges from 0 to 11 maximum.

 

Without even reaching "set variable" action, I can see that the output from previous "split" command is NOT being passed on to the 2nd "Apply to each" loop.

 

Any help would be much appreciated.

 

 

Categories:
I have the same question (0)
  • v-micsh-msft Profile Picture
    Microsoft Employee on at

    Hi @asri_zainal,

     

    Take a try to remove the scope Action, just use the Compose, then after Compose 2, add the Apply to each 2 drectly to check.

    Further, would you please take a check with the Output of Compose 2, to see if it created the corresponding items?

     

    Besides, if you could share more details about your goal and the SharePoint list data, maybe I could offer a better solution.

     

    Regards,

    Michael

  • asri_zainal Profile Picture
    54 on at

    - same results even without the scope in fact i only added the scope later on so that easily hide certain part of the flow trying to figure out what was wrong

    - Output of compose 2 is not blank

     

    just to be sure i'm not crazy or anything, i created a new test flow with the most basic information to prove that "apply to each" loop in another "apply to each" doesn't pass output from the first loop to the other. I try to keep it as close to my current flow by using same format of array and commands.

     

    It could just be a limitation however I was not able to find any resources to explain this. if i've hit a dead end here then I'll need to redesign the flow again.

     

    screencapture-asia-flow-microsoft-manage-environments-Default-61569b2e-8e58-4771-9656-aaca286ff449-flows-5a226cf3-bdfd-43cf-9638-0a58d0f80b51-1508848835154.png

    screencapture-asia-flow-microsoft-manage-environments-Default-61569b2e-8e58-4771-9656-aaca286ff449-flows-5a226cf3-bdfd-43cf-9638-0a58d0f80b51-runs-08586927582510165168972505330-1508849199854.png

     

    Basically my requirement is:

    - Sharepoint list consists of request form with single user data.

    - data includes 14 Yes/No checkboxes for departments that user need access to

    - the flow will collect all the "Yes" data and append into an array into the format: Dept->DeptOwner@company.com

    - Apply to each loop for each array items using item() follwed by split() from previous compose out "->" to gather generate a 2nd set of array which will only consist of 2 items: Dept & DeptOwner@company.com

    - Now the plan is to insert a 2nd "apply to each" loop to assign 2 variables from above: dept=Dept & DeptOwner@company.com

    - Once the variables are set, an approval proccess will be initiated using the 2 information above.

  • Verified answer
    asri_zainal Profile Picture
    54 on at

    my brain was exploring again and it seems that I can get rid of the 2nd "apply to each loop" and use filter array to get single items from the previous arrays.

    using the test flow seems to show positive results, will try to implement back to my original flow.

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 570

#2
Valantis Profile Picture

Valantis 405

#3
11manish Profile Picture

11manish 350

Last 30 days Overall leaderboard