I have an issue where duplicates are getting made in a Sharepoint List and I would like Flow to on a schedule get all the items in a list and then for each duplicate The Key to finding the duplicates would be Employee ID so Find items with the same EEID.
then for every duplicate, it finds send me an email
I am open to using REST if someone can help me with how to accomplish this.
Thanks
Solved! Go to Solution.
Here is what I ended up doing and it works. It would be nice to get all the ID in an array and then delete them all but the first one...That will be the next thing.
Hey @jeckard
I'd suggest setting the column to enforce unique values to prevent the addition of duplicates:
HTH
Jay
Hey, Jay, I think you meant to upload an image but nothing came through??
If you just want to scan for duplicates and send an email for each duplicate then you can just do two Apply to Each loops, with one inside the other. Before the first loop do a get items and inside the first loop do a get items again. Then in the second loop compare the value of the record from the first loop with the record from the second. If its a match then send an email. I used a list that has a Project choice field, just substitute the Employeeid field.
I will give you solution a try tonight and let you know!
Pstork1 I tried the solution you suggested I believe I might be setting up the loops incorrectly
Can you clarify Value one and Value two as I am getting the system creating a apply to each loop three?
Hi @jeckard ,
Please refer to screenshot below to create the flow:
Best regards,
Alice
Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I think you'll need @Pstork1 to provide some more guidance here... but I think you'll need to do the following:
1. Delete the 'Apply to each 2' and 'Apply to each 3' (and contained actions)
2. Re-add a 'Condition' action directly underneath the second 'Get Items' action
3. Select the 'Employee ID' value from the 'Get Items 1 and compare to the the 'Employee ID' value from the 'Get Items' 2... that should set the loop up correctly.
This will find duplicates but its a pretty expensive query, and it won't work for large lists (above 5000) even after enabling pagination... Working with @Pstork1 excellent suggestion I updated to the following but it still suffers the same limitation with the original query... the second query is slightly quicker as it will return a smaller result set and only do something if the array is greater than 1... i..e a duplicate exists.
This is still not really correct and needs more logic to be added a single duplicate would result in 2 separate emails (One for each duplicate item)... if your list contains less than 5000 items this may work, but I'd really suggest disabling duplicates on the list as per my original suggestion.
If you're list is above 5000 items I think will need a direct REST query using a CAML query to perform a GroupBy type query (I know distinct isn't support by ODATA)...
HTH
Jay
If you compare your screenshot to mine you will see that I have two get items statements and two loops. You have one get items statement and three loops. From what I can see I assume your first get items isn't shown in the screenshot. If so, then I don't see a need for Apply to each 2. Remove that loop. The outside loop should be the first Get items value and the inside loop should be the second.
Here is what I ended up doing and it works. It would be nice to get all the ID in an array and then delete them all but the first one...That will be the next thing.
Hi @jeckard ,
If your problem been solved, please go ahead and mark the post as solved by clicking “Accept as Solution” so that this thread will be marked for other users to easily identify!
Best regards,
Alice
Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
There is no accept as a solution just reply and mark as new.
Hi @jkeckard007 ,
I will help you mark the post as answered.
Best regards,
Alice
Community Support Team _ Alice Zhang
If this post helps, then please consider Accept it as the solution to help the other members find it more quickly.
I can't believe Microsoft doesn't have a simple array action called "removed duplicates" like Nintex had since 2007!!!
Can this be used if I want to update an item?
For e.g. I have a flow from Survey123 to Sharepoint list. I want to be able to create items (this works all good) and then update the item if an answer has changed (update is based on the unique ID I have created that passes through from Survey123 to Sharepoint List).
Currently it just keeps creating a new item.
Cheers,
Summer
User | Count |
---|---|
16 | |
16 | |
14 | |
9 | |
8 |
User | Count |
---|---|
29 | |
28 | |
24 | |
23 | |
13 |