Showing results for 
Search instead for 
Did you mean: 
Level: Powered On

Compose on Apply to Each limitation



I am tring to build a flow to analise 2 Sharepoint lists, and to show me the items that are in the list 1 but not in the list 2.

This is what I did ulti now:

  1. Obter itens is where I get items from list 2.
  2. Inicializar variável is where I am just initializing a variable.
  3. Aplicar a cada is where I am doing an apply to each for each item from list 2 to compare with items from list 1. What I am doing is to compare is the ID of the items on list 1 are not equal to items of list 2.
  4. Then I am doing another apply to each to get the items from "Obter items 2" and do an Compose to insert that items from my condition to a html Table. After that I join the table in <html> tag to the variable I initializing before, like that:
  5. The last thing I do is to send an email with my variable






My problem is when I try to test the flow it gives me this error:

Template validation failed: "The Add String_Variable template action entries" on line "1" and "4348" can not reference the "Compose" action. The "Compose" action is nested in a multi-level scope for reference. Out of scope actions are only supported when there are multiple levels of nesting."


Can someone help me finding a solution for this?

Community Support Team
Community Support Team

Re: Compose on Apply to Each limitation

Hi @Animoroly ,


I have configured the flow likes below for your scenario, please check it for a reference.


Initialize an array variable at first, then in the Apply to each 2, add action Append to array variable and input the code you provided.


Under the Apply to each2, add Compose action with the code to format an Html table:






Make sure enable Yes for Is HTML field of action send an email.



Best regards,



Community Support Team _ Mabel Mao
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
Level: Powered On

Re: Compose on Apply to Each limitation

Hello @v-yamao-msft, your solution worked but it did not give me the results I wanted.

I have received an email with 2 tables because of the "Send an email" action is inside the "Apply to Each". If I put the "Send an email" outside the "Apply to each" it gives me an error because it depends on the action inside the "Apply to each".

What I want is an email with a single table and to apply the items on the table.


Super User
Super User

Re: Compose on Apply to Each limitation

Hi @Animoroly 


You wanna receive one email for each item that has in yours two lists? Or one email with all itens that have in both?

Did I answer your question? Mark my post as a solution!

Gustavo Moraes, o astronauta brasileiro do Flow!

Helpful resources


New & Improved Power Automate Community Cookbook

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


Power Automate Community User Group Member Badge

Fill out a quick form to claim your user group badge now!


Incoming: New and improved badges!

We've given our badges an overhaul and also added some brand new ones!


Microsoft Learn

Learn how to build the business apps that you need.


Power Platform World Tour

Find out where you can attend!


Webinars & Video Gallery

Watch & learn from the Power Automate Community Video Gallery!

Top Solution Authors
Top Kudoed Authors (Last 30 Days)
Users online (4,162)