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 / Flow to check duplicat...
Power Automate
Unanswered

Flow to check duplicates in Sharepoint List

(0) ShareShare
ReportReport
Posted on by 114

Hi 

I'm trying to set up an alert if there is a duplicate in a Sharepoint list once it has been modified.

 

This is what I've tried, but it's not working, it sends the email but doesn't tell me what has been duplicated, so I can't get the HTML table to work, I think. 

 

3. Initialize Variables

  • Click on "New step" and search for "Initialize variable".
    • Set the variable name to IDList, type to Array, and leave the value empty.
    • Add another variable for the HTML table.
      • Name: HTMLTable, Type: String, Value: "".

4. Get Items from the List

  • Click on "New step" and search for "Get items".
  • Configure the "Get items" action by selecting your SharePoint site address and list name (List A).

5. Append to Array Variable

  • Click on "New step" and search for "Apply to each".
  • In "Select an output from previous steps", select the value from the "Get items" action.
  • Inside the "Apply to each" control:
    • Add an "Append to array variable" action.
      • Variable: IDList, Value: ID from "Get items".
    • Add "Append to string variable" to build HTML table rows.
      • Variable: HTMLTable
      • Value:
        html
         
        <tr><td>@{items('Apply_to_each')['ID']}</td></tr>

6. Initialize HTML Table Header

  • Before the "Apply to each" loop, initialize the HTML table header.
    • Click on "New step" and search for "Set variable".
    • Variable: HTMLTable
    • Value:
      html
       
      <table border="1" style="border-collapse: collapse;"><tr><th>ID</th></tr>

7. Close HTML Table

  • After the "Apply to each" loop, close the HTML table.
    • Click on "New step" and search for "Append to string variable".
    • Variable: HTMLTable
    • Value:
      html
       
      </table>

8. Check for Duplicates

  • Click on "New step" and search for "Condition".
  • Condition: length(variables('IDList'))
    • Operator: greater
    • Value: 0

9. Send Email with HTML Table

  • Inside the "If yes" branch of the condition, send an email with the HTML table.
    • Click on "New step" and search for "Send an email (V2)".
    • Configure the email action:
      • Recipient: (your choice)
      • Subject: "Duplicate IDs Found"
      • Body:
        html
         
        <p>The following IDs are duplicated:</p> @{variables('HTMLTable')}

Complete Flow Outline

  1. Trigger:

    • When an item is created or modified.
  2. Initialize Variables:

    • IDList (Array)
    • HTMLTable (String, initialized to HTML table header)
  3. Get Items from List:

    • Retrieve items excluding the current item.
  4. Append to Array Variable:

    • Append IDs to IDList and build HTML table rows inside "Apply to each".
  5. Close HTML Table:

    • Append closing HTML tags to HTMLTable.
  6. Check for Duplicates:

    • Condition to check if IDList length is greater than 0.
  7. Send Email:

    • Send an email with the HTMLTable in the body if duplicates are found.
Categories:
I have the same question (0)
  • Anil_g Profile Picture
    668 Moderator on at

    @BenBennett321 

     

    1. First check flow run history and check if get items is retreiving the right items

    2. Can you check the final html format created from the last append to string variable activity..from there we can see if html is proper


    also here it should be like this with expression concat('<tr><td>',items('Apply_to_each')?['ID'],'</td></tr>')

     

    cheers

  • BenBennett321 Profile Picture
    114 on at

    Thanks for your reply:

     

    " Can you check the final html format created from the last append to string variable activity..from there we can see if html is proper"

     

    I'm not sure how to do this?

     

    and this "also here it should be like this with expression concat('<tr><td>',items('Apply_to_each')?['ID'],'</td></tr>')" 

     

    Where should the concat go? in the condition or somewhere else?

     

  • Anil_g Profile Picture
    668 Moderator on at

    @BenBennett321 

     

    the concat should go inside loop

     

    and to check open flow run page...and open the output of the final compose activity you would be able to see

     

    for detailed explanation check my reply here https://powerusers.microsoft.com/t5/Building-Flows/Compose-an-Html-table/m-p/2806423

     

    cheers

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

#2
Tomac Profile Picture

Tomac 364 Moderator

#3
abm abm Profile Picture

abm abm 243 Most Valuable Professional

Last 30 days Overall leaderboard