Share via

How to create a Power Automate flow that creates an HTML report of overdue Planner tasks and emails that HTML to the employees manager

Connor Sorenson 0 Reputation points
2026-03-13T18:11:33.86+00:00

I have been struggling with this for a while. I am able to to List Tasks and apply a filter array, but i am struggling after that. I believe it is getting hung up as it wants to iterate through the tasks, and then it iterates the Assignees so i end up having an outer loop and an inner loop (which makes sense to me actually). Could anyone provide some instruction on what the flow/loops might look like? I've been pulling my hair out for a few days now!

Microsoft Teams | Microsoft Teams for business | Tasks | Manage tasks
0 comments No comments

2 answers

Sort by: Most helpful
  1. Ryan-N 12,025 Reputation points Microsoft External Staff Moderator
    2026-03-13T18:37:21.88+00:00

    Hi @Connor Sorenson,

    Welcome to the Microsoft Q&A forum.

    I would like to provide you with the following information:

    As our current support scope primarily focuses on Microsoft 365 products, while the issue you are experiencing is related to Microsoft Power Apps, I want to ensure that you receive the most accurate and effective support possible. For that reason, I recommend that you post your question in the Microsoft Power Platform Community forum:

     Power Platform Community 

    There, you will receive responses from the appropriate subject-matter experts, and partners who regularly follow the forum may also share their experience or learn from your case.

    I apologize for redirecting you to a different community; however, since the scope of this category mainly focuses on Microsoft 365, my knowledge of Power Apps is limited. Guiding you to the most suitable support channel will help you receive a faster and more accurate solution.

    I hope this information is helpful.

    If you have any questions or need further assistance, please feel free to share them in the comments on this post so I can continue to support you.

    I look forward to continuing the conversation.


    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread. 

    0 comments No comments

  2. Q&A Assist
    2026-03-13T18:12:00.29+00:00
    AI generated content. This question contains an answer created with AI from Q&A Assist. Learn more

    Power Automate can handle nested loops over Planner tasks and assignees by using Apply to each on arrays and then building up an HTML string in a variable that is finally sent by email. At a high level, the flow needs to:

    1. Run on a schedule.
    2. Get Planner tasks and filter to overdue ones.
    3. For each overdue task, iterate its assignees.
    4. Group tasks by manager and build an HTML report per manager.
    5. Send one email per manager with the HTML body.

    A possible structure using the techniques shown in the context would look like this:

    1. Trigger
      • Use a Scheduled cloud flow trigger (similar to the examples in the context) to run daily or weekly.
    2. List tasks and filter overdue
      • Add a Planner List tasks action for the relevant plan/bucket.
      • Use a Filter array action on the tasks array to keep only tasks where:
        • dueDateTime is not empty, and
        • dueDateTime is less than utcNow() (overdue), and
        • percentComplete < 100 (not completed).
    3. Initialize variables (similar to the variable initialization patterns in the context)
      • HTML template variable (String): holds the HTML header and table structure, for example:
        • <html><body><h2>Overdue Planner Tasks</h2><table border='1'><tr><th>Task</th><th>Due Date</th><th>Assignee</th></tr>
      • Manager-to-tasks map (Array or Object): to group tasks by manager. If using an array, each element can be an object like { ManagerId, ManagerEmail, RowsHtml }.
    4. Outer loop – Apply to each overdue task
      • Add Apply to each on the Filter array output (overdue tasks). This is like the Apply to each usage described in the context where an array of items is processed one by one.
      • Inside this loop:
        1. Get the task details if needed (Planner Get task details).
        2. For each task, get its assignees (from the task’s assignments property or a separate action depending on connector).
    5. Inner loop – Apply to each assignee
      • Inside the task loop, add another Apply to each on the assignees collection.
      • For each assignee:
        1. Use Get user profile (V2) (Microsoft Entra ID / Office 365 Users) to get:
          • Assignee display name
          • Assignee’s manager (if available via manager or a separate action)
        2. Determine the manager’s email address.
        3. Build an HTML row string for this task/assignee, for example:
          • <tr><td>[Task Title]</td><td>[Due Date]</td><td>[Assignee Name]</td></tr>
        4. Append this row into the manager’s entry in the Manager-to-tasks variable:
          • If the manager already exists in the array/object, append to its RowsHtml.
          • If not, create a new element for that manager with initial RowsHtml containing this row.
      This pattern mirrors the array-building approach shown in the context where an Array variable is initialized and then Append to array is used inside loops.
    6. After loops – Build final HTML per manager
      • Once both loops complete, the Manager-to-tasks variable contains one element per manager with all their overdue task rows.
      • Add an Apply to each on the Manager-to-tasks array.
      • Inside this loop:
        1. Compose the full HTML body for that manager by concatenating:
          • The HTML header/table start from the HTML template variable.
          • The manager’s RowsHtml value.
          • The closing tags: </table></body></html>.
    7. Send email to each manager
      • Still inside the manager loop, add an Outlook – Send an email (V2) action.
      • To: Manager’s email from the current array element.
      • Subject: e.g., “Overdue Planner Tasks for Your Team”.
      • Body: the composed HTML string.
      • Set Is HTML to Yes so the table renders correctly.
    8. Key implementation notes
      • Nested Apply to each loops are expected here (tasks → assignees). The important part is to avoid sending an email inside the inner loop; instead, aggregate rows into variables and send emails after grouping.
      • Use Initialize variable (String and Array) and Append to array variable exactly as shown in the context examples for building collections and payloads.
      • If only a single manager is needed (for example, the manager of all employees), the design can be simplified: skip grouping and just append all rows into one HTML variable, then send a single email.

    This structure uses the same core building blocks highlighted in the context: scheduled flows, Apply to each over arrays, and initializing/using array and string variables to build up a result that is then used in a final action.


    References:

    0 comments No comments

Your answer

Answers can be marked as 'Accepted' by the question author and 'Recommended' by moderators, which helps users know the answer solved the author's problem.