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

Notifications

Announcements

Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / An error when composin...
Power Automate
Unanswered

An error when composing data from "Apply to each"

(0) ShareShare
ReportReport
Posted on by 49

Hello,

 

I have a table with BU, FTY and item information.
I would like to get BU and item information for each supplier, create HTML table and send email.

I created a flow as below, but when I save the flow, it shows this error message

"Flow save failed with code 'InvalidTemplate' and message 'The template validation failed: 'The inputs of template action 'Compose' at line '1 and column '47860' cannot reference action 'ComposeHTML'. The action 'ComposeHTML' 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.'.'."

 

Wish anyone can help on this.

 

@DamoBird365 , I followed one of your Youtube video concept on creating this flow, maybe you can help on this.

 

DavidLin_2-1656671405957.png

 

 

 

Categories:
I have the same question (0)
  • Verified answer
    edgarsimoes Profile Picture
    Microsoft Employee on at

    Hello, @DavidLin 

     

    Based on the context that you give, the issue of getting that error is due to the fact that you're looping two times.

     

    I would recommend to initialize a variable in the begining of the flow, and then append to the variable the output inside of your loop, instead of using a compose action. 

     

    Or try to create the action "send an email" inside of your loop, and see what happens.

     

    Let me know if I was able to help you.

     

    Please 'Thumbs Up' the posts that helped you and 'Accept as Solution' if my post answered your question.

     

    Happy Automating,

     

    Edgar Simões

  • DavidLin Profile Picture
    49 on at

    Hi @edgarsimoes , Thank you! Your suggestion to use append to string worked, I changed the flow like below. It's simpler than what I thought. 

    BTW, I am still looping two parameters, one is supplier, and another is BU in my current loop with "append to string". Could you help to elaborate more about your saying "the issue of getting that error is due to the fact that you're looping two times." and help me understand more the reason on this issue?

    DavidLin_0-1656749447473.png

     

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

Forum hierarchy changes are complete!

In our never-ending quest to improve we are simplifying the forum hierarchy…

Ajay Kumar Gannamaneni – Community Spotlight

We are honored to recognize Ajay Kumar Gannamaneni as our Community Spotlight for December…

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 538 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 405 Moderator

#3
abm abm Profile Picture

abm abm 252 Most Valuable Professional

Last 30 days Overall leaderboard