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 / I want to build a sing...
Power Automate
Unanswered

I want to build a single email with multiple tables from mutiple for each loops

(0) ShareShare
ReportReport
Posted on by
Hi all,
 
Thanks for taking the time to read this!
 
My goal is to create a recurring email with multiple HTML tables in it from multiple connected sources.
 
I have tables for Employees, Contacts, Companies, Opportunities, Projects, and Relationships.
The Relationships table shows connections between Employees and Contacts. All Contacts are connected to a Company. Companies can also be connected to Opportunities and Projects as a Primary Client.
For my Flow, I want to:
  1. Search through Employees to find members of a specific team
  2. For each Employee, find all of their Relationship records that have been created in the last week.
  3. Create an HTML Table of those Relationships
  4. Then for each Relationship Contact found
    1. Find that Contact’s Company from the Contacts’ record
    2. Find all Opportunities where that Company is the Primary Client
    3. Create an HTML Table of those Opportunities
    4. Find all Projects where that Company is the Primary Client
    5. Create an HTML Table of those Projects
    6. Check the Relationship Table for any other Employees Related to that Contact
    7. Create an HTML Table of those Employees
  5. Create an Email with ALL HTML Tables inside of it and send that email to the selected Employee.
 
 
Currently I have Steps 1-3 Working correctly and then it gets broken when attempting Steps 4-5.  The problem I'm running into is that the Create HTML Table action needs to be nested in the same for each loop where the data i drawn from and then it's not available for the email since the email is outside of those For Each loops. And I can't build the tables after the For Each loops gather all the data as that throws an error: ' 'InvalidTemplate' and message 'The template validation failed: 'The repetition action(s) 'For_each' referenced by 'inputs' in action 'Create_Project_Table-copy' are not defined in the template.'.'. 
 
What's the workaround for this or is my structure off from the get go?

Any help is greatly appreciated!
Categories:
I have the same question (0)

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 April Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Vish WR Profile Picture

Vish WR 957

#2
Valantis Profile Picture

Valantis 847

#3
Haque Profile Picture

Haque 609

Last 30 days Overall leaderboard