Removing Duplicate Records via a Microflow

6
I need to delete duplicate records that were inadvertently created during an excel import process. 1) I can confirm that the duplicate behavior will not happen again. 2) I just need to remove the duplicate entries that were created in one entity. Entity "A" has duplicate records. The duplicate records can be isolated based on a single text field. I created a microflow. I retrieved the entity, then I was trying to create a new list based on the duplicate entries, and then delete the list. However, I cannot figure out the correct way to inspect the entity for these duplicates. The field I'm looking to compare is "Note" I know this is super easy -- but I can't get it to work. Thanks in advance for your help and patience as I learn! -- AC
asked
2 answers
21
  1. Create a new empty list in a microflow
  2. Create a loop over the list that you retrieved (with duplicates)
  3. In the loop check if the new list contains the iterator by doing a find list operation and comparing the note field
  4. If already in the list continue
  5. if not in the list add to the list
  6. Now at the end of the loop you have 2 lists, one with all records and one with the unique records
  7. After the loop subtract the new list from the list with all records
  8. Perform a delete on the list that is returned from the subtraction
  9. The entity does not have duplicates anymore.
answered
0

Another approach that might work: if you stored createdDate in the entity, you could do a retrieve on a date/time range to retrieve only the records you want to delete then delete them. For instance, lets say you ran the initial import today at 9:00 and ran the second import today at 9:30. If you wanted to delete the initially imported records, you could retrieve those records with a create date time <= today at 9:30 and delete the retrieve list.

Hope that helps.

answered