Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Send Single Email Per Contact from SharePoint List including Table

(0) ShareShare
ReportReport
Posted on by

Hello,

 

I am trying to build a flow to, upon running it, automatically send a single email per PM contact with relevant information of each related project aggregated in a table. PM contact and information per project is extracted from a SharePoint List.

PM Contact is a single line text field/column containing an email address (ex. JohnSmith@company.com).

 

I tried a few attempts, in my latest flow:

a. 1 email per project was being sent instead of 1 email per PM contact

b. The same project was being repeated on several rows instead of aggregating projects per PM

c. Since it is an HTML table I believe, I am getting the full path/div class instead of just the answer (as an example under Changes here I should only get No) 

 

Few columns from SharePoint List:

alberto1_2-1631728438226.png

 

Latest Email Table:

alberto1_3-1631728641198.png

 

Latest Flow:

alberto1_1-1631728410079.png

 

alberto1_0-1631728381057.png

 

All help and advice is appreciated!

  • Verified answer
    Community Power Platform Member Profile Picture
    on at
    Re: Send Single Email Per Contact from SharePoint List including Table

    In case anyone looks at this at a later time, I was able to resolve my issue as follows:

     

    1. Added a Select  after Table CSS

    1. From: Body of the Filter Array: body('Filter_array') (you should be able to select it in Dynamic content)
    2. Map: Use the value you need in Enter value, you can leave Enter Key empty unless needed: enter the following expression: item()?['field name']

    2. Added a Compose to turn the select array into a string with this expression:  string(body('Select')) in my case I renamed the select so it was string(body('Select_Project_ID'))

     

    3. Added another Compose to clean up the string using this expression: 

    replace(replace(replace(replace(replace(replace(replace(outputs('Compose'), '['''), ']'''), '{'''), '}'''), ','', '), '"'''), ':'''); in my case I renamed the Compose to Project_ID
     
    4. I was able to use the clean output from the last compose (you can find it in Dynamic content) in the email as per below
     
    alberto1_0-1632249907365.png

     

    Here's the full flow for this loop:

     

    alberto1_1-1632250048439.png

     

    I cleaned the HTML Table using this expression in a Compose (Replace Special Characters in the above snapshot):

    replace(replace(replace(replace(replace(replace(replace(body('Create_HTML_table'), '&lt;''<'), '&gt;''>'), '&amp;''&'), '&#39;''"'), '&#58;'':'), '&quot;''"'), '<br>'' ')
     
    Some useful Links
  • Community Power Platform Member Profile Picture
    on at
    Re: Send Single Email Per Contact from SharePoint List including Table

    Hi @eric-cheng,

     

    I am stuck at the email part now, can't seem to figure out the correct expression to get Dynamic Content while avoiding an additional loop. I tried items('ForEach_Unique_PM')?['Project_x0020_ID']', and ended up with the following error:

    Unable to process template language expressions in action 'Send_an_email_(V2)' inputs at line '1' and column '31935': 'The template language expression 'items('ForEach_Unique_PM')?['Project_x0020_ID']' cannot be evaluated because property 'Project_x0020_ID' cannot be selected. Property selection is not supported on values of type 'String'. Please see https://aka.ms/logicexpressions for usage details.'. 

     

    alberto1_3-1631897547200.png

    Any ideas?

     

    Thank you!

  • Community Power Platform Member Profile Picture
    on at
    Re: Send Single Email Per Contact from SharePoint List including Table

    Ok nevermind, I made this part work, by using an expression for each entry:

    item()?['field name']

  • Community Power Platform Member Profile Picture
    on at
    Re: Send Single Email Per Contact from SharePoint List including Table

    Hi @eric-cheng,

     

    I finally managed to replicate the flow indicated in the post/article (http://johnliu.net/blog/2018/6/do-group-by-in-flow-with-two-simple-elegant-loops😞

    alberto1_0-1631893998409.png

     

    However it seems it only works as long as you are not using dynamic content.

    As soon as you try to use Dynamic Content anywhere, it automatically creates an additional Apply to Each loop which seems to mess up the flow:

     

    alberto1_2-1631894469049.png

     

    When I attempted this I got the following error message:

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

     

    Any ideas on how to handle this?

     

    Thank you!

  • Community Power Platform Member Profile Picture
    on at
    Re: Send Single Email Per Contact from SharePoint List including Table

    Thank you @eric-cheng.

     

    I will look into it and try to implement it.

     

    I will let you know how it goes and we can take it from there!

  • eric-cheng Profile Picture
    5,171 on at
    Re: Send Single Email Per Contact from SharePoint List including Table

    Hi @Anonymous ,

     

    Please check out the post here which has two solutions for a group by functionality.

     

    --------------------------------------------------------------------------
    If I have answered your question, please mark my post as a solution
    If you have found my response helpful, please give it a thumbs up

    Connect on LinkedIn

  • Community Power Platform Member Profile Picture
    on at
    Re: Send Single Email Per Contact from SharePoint List including Table

    Hi @eric-cheng,

     

    Yes, that's correct!

     

    I want to send 1 e-mail per contact, aggregating Project ID and changes per project in a table, where all the information per Project ID is on a SharePoint List, including the contact email address. 

  • eric-cheng Profile Picture
    5,171 on at
    Re: Send Single Email Per Contact from SharePoint List including Table

    Hi @Anonymous ,

     

    So just to confirm, you want to send 1 email to each contact which aggregates their project ID and changes?

     

    --------------------------------------------------------------------------
    If I have answered your question, please mark my post as a solution
    If you have found my response helpful, please give it a thumbs up

    Connect on LinkedIn

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

Paul Stork – Community Spotlight

We are honored to recognize Paul Stork as our July 2025 Community…

Congratulations to the June Top 10 Community Leaders!

These are the community rock stars!

Announcing the Engage with the Community forum!

This forum is your space to connect, share, and grow!

Leaderboard > Power Automate

#1
Michael E. Gernaey Profile Picture

Michael E. Gernaey 497 Super User 2025 Season 1

#2
David_MA Profile Picture

David_MA 436 Super User 2025 Season 1

#3
Riyaz_riz11 Profile Picture

Riyaz_riz11 244 Super User 2025 Season 1