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 / Merge two Sharepoint l...
Power Automate
Answered

Merge two Sharepoint lists to create html for email

(0) ShareShare
ReportReport
Posted on by 402

I have a power automate process that is triggered by a new SharePoint list entry (power apps is used as the UI).  Data is saved to two lists with a record ID as the relational key for each record.  In power automate I am using a Get Items connector to get each lists records based on that record ID.  So I have two different sets of records from two different sharepoint lists.  Now I would like to merge those two lists into one table so I can compose HTML to use with an email connector.  Is there a way to do this somehow?

 

Thanks for the information

Categories:
  • Verified answer
    Mira Ghaly Profile Picture
    11,415 Moderator on at

    @iskguy 

    You can use the Union Expression generally if you need to merge 2 lists, where collection-1 is the values output of your first Get Items , and collection_2 for the second one

    union(collection_1: object|array, collection_2: object|array)
    

     

  • iskguy Profile Picture
    402 on at

    Thanks for the response.  So I can do a compose with the Union expression?

  • iskguy Profile Picture
    402 on at

    Or moreso, how do I get a datapoint after the union is done in a compose?  Is it like a json file that is generated?

  • Verified answer
    SudeepGhatakNZ Profile Picture
    14,396 Most Valuable Professional on at

    The output of your compose function will have the JSON-formatted data

  • Mira Ghaly Profile Picture
    11,415 Moderator on at

    @iskguy 

     

    Yes formatted JSON

  • iskguy Profile Picture
    402 on at

    The result output has two records in the JSON file - one for each list I believe.  Now what I need to do is to flatten that data into ONE record.  Or select the field from the file. In testing, I used the Select connector and from there I was able to create those values in the body of an email, however, the test sent TWO emails (one for each record in the JSON file).  I just need it to send one email. 

     

    [
     {
     "@odata.etag": "\"1\"",
     "ItemInternalId": "1",
     "ID": 1,
     "Title": "6043e266-6550-400d-9e38-432b9ea9a67a",
     "KARE": false,
     "MSDynamics": false,
     "OtherApps": "Power Apps, Power BI, SharePoint Admin",
     "KAREEmailAlerts": false,
     "KAREUnreadMessages": false,
     "KARESupervisorSign": false,
     "DeleteKARE": true,
     "DeleteGP": false,
     "Modified": "2023-02-28T20:06:42Z",
     "Created": "2023-02-28T20:06:42Z",
     "Author": {
     "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
     "Claims": "i:0#.f|membership|XXX",
     "DisplayName": "Allison",
     "Email": "XXX",
     "Picture": "XXX",
     "Department": "Information Technology Services",
     "JobTitle": "Software Developer"
     },
     "Author#Claims": "i:0#.f|membership|XXX",
     "Editor": {
     "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
     "Claims": "i:0#.f|membership|ballison@iskzoo.org",
     "DisplayName": "Allison",
     "Email": "XXX",
     "Picture": "XXX",
     "Department": "Information Technology Services",
     "JobTitle": "Software Developer"
     },
     "Editor#Claims": "i:0#.f|membership|XXX",
     "{Identifier}": "Lists%252fEURAppAccess%252f1_.000",
     "{IsFolder}": false,
     "{Thumbnail}": {
     "Large": null,
     "Medium": null,
     "Small": null
     },
     "{Link}": "XXX",
     "{Name}": "6043e266-6550-400d-9e38-432b9ea9a67a",
     "{FilenameWithExtension}": "6043e266-6550-400d-9e38-432b9ea9a67a",
     "{Path}": "Lists/EURAppAccess/",
     "{FullPath}": "Lists/EURAppAccess/1_.000",
     "{HasAttachments}": false,
     "{VersionNumber}": "1.0"
     },
     {
     "@odata.etag": "\"1\"",
     "ItemInternalId": "1",
     "ID": 1,
     "Title": "6043e266-6550-400d-9e38-432b9ea9a67a",
     "MonitorMailbox": true,
     "MailboxMonitorDuration": 30,
     "AdditionalComments": "This is a test",
     "PersonsToMonitor": "Josh Dale",
     "Modified": "2023-02-28T20:06:42Z",
     "Created": "2023-02-28T20:06:42Z",
     "Author": {
     "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
     "Claims": "i:0#.f|membership|XXX",
     "DisplayName": "Allison",
     "Email": "XXX",
     "Picture": "XXX",
     "Department": "Information Technology Services",
     "JobTitle": "Software Developer"
     },
     "Author#Claims": "i:0#.f|membership|XXX",
     "Editor": {
     "@odata.type": "#Microsoft.Azure.Connectors.SharePoint.SPListExpandedUser",
     "Claims": "i:0#.f|membership|XXX",
     "DisplayName": "Allison",
     "Email": "XXX",
     "Picture": "XXX",
     "Department": "Information Technology Services",
     "JobTitle": "Software Developer"
     },
     "Editor#Claims": "i:0#.f|membership|XXX",
     "{Identifier}": "Lists%252fEUROther%252f1_.000",
     "{IsFolder}": false,
     "{Thumbnail}": {
     "Large": null,
     "Medium": null,
     "Small": null
     },
     "{Link}": "XXX",
     "{Name}": "6043e266-6550-400d-9e38-432b9ea9a67a",
     "{FilenameWithExtension}": "6043e266-6550-400d-9e38-432b9ea9a67a",
     "{Path}": "Lists/EUROther/",
     "{FullPath}": "Lists/EUROther/1_.000",
     "{HasAttachments}": false,
     "{VersionNumber}": "1.0"
     }
    ]

    This is the JSON with some elements obfuscated (XXX).  The actual elements needed from this example would be DeleteKARE, DeleteGP, OtherApps, MonitorMailbox, MonitorMailboxDuration, PersonsToMonitor, AdditonalComments.  It did seem like the Select works, but for some reason I cannot refer to those select elements in the email body. 

  • iskguy Profile Picture
    402 on at

    Because of the merge, the resulting file is TWO "rows" of data.  Is there a way to select the fields I need or merge these two rows into a flat single file?

  • SudeepGhatakNZ Profile Picture
    14,396 Most Valuable Professional on at

    Are you able to post a screenshot of your flow?

    You can use select action and then create an HTML table and insert the table in an email

     

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

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Leaderboard > Power Automate

#1
Mohsin Ali Profile Picture

Mohsin Ali 423

#2
11manish Profile Picture

11manish 308 Super User 2026 Season 2

#3
M Bilal Khan Profile Picture

M Bilal Khan 177

Last 30 days Overall leaderboard