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 / using Compose action t...
Power Automate
Suggested Answer

using Compose action to replace append to array failed in nested For each loop

(0) ShareShare
ReportReport
Posted on by 277
I have a flow with 2 level nested loop. It will loop thru a SharePoint list and then generate a CSV using the data. At the beginning I am using Append to Array action to build an Array and then create the CSV file. It is working but take very long to complete.
 
Later I read Speeding Up Power Automate: Replacing 'Append to Variable' with 'Compose' for Efficient Workflows - Fredrik Engseth I am trying to replace "Append to Array" action with Compose action.
 
However, I got the error :
The template validation failed: 'The inputs of template action 'Compose' at line '1 and column '3838' cannot reference action 'Compose_csv'. The action 'Compose_csv' is nested in a foreach scope of multiple levels. Referencing repetition actions from outside the scope is supported only when there are no multiple levels of nesting
 
The first "For each" is for each sharepoint list item. The second for each is "For each" JSON record in a sharepoint list field.
Is there any way to work around it?
 
 
 
Categories:
I have the same question (0)
  • Suggested answer
    Pstork1 Profile Picture
    69,129 Most Valuable Professional on at
    I've run into this in the past. What I did was make that nested loop into a child flow that returned the array of values that the compose would normally create.  You can then union those with a previous array to get a full array.

    ----------------------------------------------------------------------------------
    If this Post helped you, please click "Does this answer your question" and give it a like to help others in the community find the answer too!

    Paul Papanek Stork, MVP
    Blog: https://www.dontpapanic.com/blog
     

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 605

#2
Valantis Profile Picture

Valantis 340

#3
11manish Profile Picture

11manish 284

Last 30 days Overall leaderboard