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 / Help with sending HTML...
Power Automate
Unanswered

Help with sending HTML emails for multi-user task assignments in SharePoint list

(0) ShareShare
ReportReport
Posted on by 5

Hi Everyone,

I'm working on a Power Automate flow that sends HTML email notifications for SharePoint list tasks. I'm encountering issues with the 'Assigned To' column which allows multiple user selections.

Current Setup:

  • SharePoint list with multiple columns (Title, Status, Assigned To, Due Date)
  • 'Assigned To' column is configured to allow multiple users
  • Using HTML email template to display task information

Issues:

  1. When trying to include the 'Assigned To' field in the HTML email content, it shows blank when multiple users are assigned
  2. The flow needs to send personalized task list emails to each assigned user

Goal:

  • Send HTML formatted emails to each assigned user containing:
    • A list of all tasks they are assigned to
    • For each task, show complete details including:
      • Title
      • Status
      • Due Date
      • All team members assigned to that same task (showing who else is working on it with them)

For example, if John is assigned to Task A (with Mary and Steve) and Task B (with Tom), John's email should show both tasks and include Mary and Steve as co-assignees for Task A, and Tom for Task B.

I followed this YouTube tutorial Power Automate Send Task Due Reminder Emails but it only handles single-user assignments. Could someone help me modify the flow to achieve this?

Thank you in advance for any guidance!

Categories:
I have the same question (0)
  • Chriddle Profile Picture
    8,441 Super User 2025 Season 2 on at
    If AssignedTo is an array, you might want to use xpath:
     
     
    Compose-Get items
    I inserted the response of a “Get items” action into a Compose and reduced it to the essentials.
    There are 2 list items. One is assigned to Jim and Jane, the other one is only assigned to Jim:
    {
        "statusCode": 200,
        "headers": {
        },
        "body": {
            "value": [
                {
                    "Title": "Title 0",
                    "Status": "Open",
                    "DueDate": "2024-12-11",
                    "AssignedTo": [
                        {
                            "DisplayName": "Smith, Jim",
                            "Email": "jim@example.com"
                        },
                        {
                            "DisplayName": "Jones, Jane",
                            "Email": "jane@example.com"
                        }
                    ]
                },
                {
                    "Title": "Title 1",
                    "Status": "Open",
                    "DueDate": "2024-12-11",
                    "AssignedTo": [
                        {
                            "DisplayName": "Smith, Jim",
                            "Email": "jim@example.com"
                        }
                    ]
    	    }
            ]
        }
    }
    Apply to each
    This gets the distinct email addresses from all AssignedTo objects:
    union(
    	xpath(
    		xml(json(concat('{"Root":{"Item":',body('Compose-Get_items'),'}}'))),
    		'//AssignedTo/Email/text()'
    	),
    	json('[]')
    )
     
    Filter array
    Filters for items where email addresses from AssignedTo contain the current "Apply to each" item: 
    From:
    body('Compose-Get_items').value
    Filter:
    xpath(
    	xml(json(concat('{"Root":{"Item":', item().AssignedTo, '}}'))),
    	'//Email/text()'
    )
    contains
    items('Apply_to_each')
     
    Create HTML table
    From:
    body('Filter_array')
    Title:
    item().Title
    etc.
     
    AssignedTo:
    join(
    	xpath(
    		xml(json(concat('{"Root":{"Item":',item().AssignedTo,'}}'))),
    		'//Email/text()'
    	),
    	'; '
    )
     
    The result is an HTML table for Jim:
    and a second HTML table for Jane:
    Now style and send each of them to items('Apply_to_each')
     
  • mdn555 Profile Picture
    5 on at

    Thank you - I'm excited to get your help!

    Regarding the 'Distinct Assigned To' step in my flow - I'm currently using a Compose action with:

    union(body('Select'), body('Select'))

    I have a few questions:

    1. Am I correct that this isn't creating an AssignedTo array? If not, what changes do I need to make? Should I add an Initialize Variable action with Type Array?
    2. For the Compose - Get Item action, I'm unsure what the input should be in the Parameters tab.

    For context, I've attached a screenshot in my original post showing my current flow configurations:

    Get Item:

    • Filter Query: (ACTIVE_x002f_COMPLETE eq 'ACTIVE') and (DueBy ge '@{startOfDay( utcNow())}') and (DueBy le '@{startOfDay(addDays(utcNow(),outputs('Due_in_x_days')))}')
    • Order By: DueBy
    • Top Count: 5000

    Select:

    • From: @{outputs('Get_items')?['body/value']}
    • Map: @{item()?['Email']}

    Compose - District Assigned To Parameters:

    • Inputs: union(body('Select'),body('Select'))

    Apply to each: @{outputs('Distinct_Assigned_To')}

    Apply to each Inside loop:

    • Filter array From: @{outputs('Get_items')?['body/value']}
    • Filter Query: @{item()?['Email']} is equal to @{items('Apply_to_each')}

    Create HTML Table - I will make it match to yours

    For the Send an email (v2) action, what should I add to the To: field to ensure everyone receives the email?"

  • Chriddle Profile Picture
    8,441 Super User 2025 Season 2 on at
     I'm currently using a Compose action with:
    union(body('Select'), body('Select'))
    ... that this isn't creating an AssignedTo array?
     
    If AssignedTo is a multi person column, the value is an array of person objects.
    Such an array has a structure like this (with some additional object properties):
    [
        {
    	"DisplayName": "Smith, Jim",
    	"Email": "jim@example.com"
        },
        {
    	"DisplayName": "Jones, Jane",
    	"Email": "jane@example.com"
        }
    ]
     
     
    Your union() function will return an array of distinct combinations of these persons.
    With my example data, your expression would return an array of objects like this: [[Jim, Jane], [Jim]].
    But you probably want just [Jim, Jane]
     
    That's what the following expression does (the input of my "Apply to each" and for distinction I just use the Email property):
    union(
    	xpath(
    		xml(json(concat('{"Root":{"Item":',body('Compose-Get_items'),'}}'))),
    		'//AssignedTo/Email/text()'
    	),
    	json('[]')
    )

     
    For the Compose - Get Item action, I'm unsure what the input should be in the Parameters tab.
    This Compose is just the return value of your "Get items", probably this:
    outputs('Get items')
     
    For testing my proposal, you should just create a Compose with the name "Compose-Get items" and add the vaslue above.
    If this works, you can think about changing my expressions to directly address the original "Get items" action.
     
     

     
    For the Send an email (v2) action, what should I add to the To: field to ensure everyone receives the email?
    If you place the "Send an email" action in the "Apply to each" loop, the "To" field should be the following (as mentioned in my post):
    items('Apply_to_each')
     
  • Gyllentid Profile Picture
    894 on at
    For the array of Assigned to for each task, I'd use the action append to string. You can add a comma and whitespace when adding. So you can use the Select action, the an apply to each and then use this action.
  • mdn555 Profile Picture
    5 on at
    Thank you! 

    Before I continue to create HTML Table action, I went ahead and test the flow and I received an error message:

    Unable to process template language expressions for action 'Apply_to_each' at line '0' and column '0': 'The template language function 'json' parameter is not valid. The provided value '{"Root":{"Item":}}' cannot be parsed: 'Unexpected character encountered while parsing value: }. Path 'Root.Item', line 1, position 16.'.

    Do I need to look at input or output from Compose-Get items to resolve this issue?

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 501 Super User 2025 Season 2

#2
Tomac Profile Picture

Tomac 323 Moderator

#3
abm abm Profile Picture

abm abm 237 Most Valuable Professional

Last 30 days Overall leaderboard