Skip to main content

Notifications

Community site session details

Community site session details

Session Id :
Power Automate - Building Flows
Answered

Send report based on same ID to one or multiple emails

(0) ShareShare
ReportReport
Posted on by

Hello, I would like to create a flow to create email format/report (html body) and send it to one or more email. Here's example of my data. My datatable is in Dataverse but I will show an excel picture to be more understandable.

deerzzxdell_0-1703059699341.png

From this table I will get 2 reports for one Id Number 12345 and another for Id Number 11111. All email isn't unique so the unique value here will be Id Number. 

 

I have look through many solution in here, but they're mostly about sending multiple items to one unique email. 

  • Verified answer
    grantjenkins Profile Picture
    11,059 Super User 2025 Season 1 on at
    Re: Send report based on same ID to one or multiple emails

    Hopefully this is what you're after. Note that I've used a SharePoint List, but would be the same concept for your Dataverse table. Also, I'm not sure what you want to output, so I've just taken a couple of the columns from the list and put them into an HTML table.

     

    SharePoint List used for this example.

    grantjenkins_0-1703069449418.png

     

    See full flow below. I'll go into each of the actions.

    grantjenkins_1-1703069471980.png

     

    Get items retrieves all your list items (you would use your List rows to get the data from your Dataverse table here).

    grantjenkins_2-1703069564973.png

     

    Select Id Numbers is a Select that extracts out all of the Id Numbers.

    grantjenkins_3-1703069617951.png

     

    Style HTML table is a Compose that contains some CSS for styling the HTML table when we send it via email.

    <style>
     table {
     border-collapse: collapse;
     }
     table td,
     table th {
     border: 1px solid #ddd;
     padding: 6px 20px;
     text-align: left;
     }
     table th {
     background-color: #1C6EA4;
     color: white;
     }
    </style>

    grantjenkins_4-1703069677452.png

     

    Apply to each uses the following expression so it will iterate over each unique Id Number.

    union(body('Select_Id_Numbers'), body('Select_Id_Numbers'))

    grantjenkins_5-1703069752773.png

     

    Filter array will filter out only the items where the Id Number is equal to the Id Number we are currently iterating over.

    grantjenkins_6-1703069799213.png

     

    Select Emails extracts out all the emails from the Filter array (items that match the current Id Number).

    //You would need to put the internal name of your Email column
    item()?['Email']

    grantjenkins_7-1703069892151.png

     

    Create HTML table uses the output from the Filter array and maps the columns we want in our Table. I've just mapped out Account Name and Account Number for this example.

    //You would need to use the internal names of your Dataverse columns
    
    //Account Name (I renamed the Title column in my List for Account Name)
    item()?['Title']
    
    //Account Number
    item()?['Account Number']

    grantjenkins_8-1703070050593.png

     

    Send an email uses the following expression to get a unique list of emails separated by a semi-colon.

    join(union(body('Select_Emails'), body('Select_Emails')), ';')

    grantjenkins_9-1703070263002.png

     

    After running the flow, two emails would be sent - one for each of the Id Numbers.

    grantjenkins_10-1703070334433.png

     

    grantjenkins_11-1703070361988.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

Michael Gernaey – Community Spotlight

We are honored to recognize Michael Gernaey as our June 2025 Community…

Congratulations to the May 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 >