# How can I delete a duplicate entry automatically?

**URL:** https://community.fibery.io/t/how-can-i-delete-a-duplicate-entry-automatically/1968
**Category:** Get Help
**Created:** [September 1, 2021, 12:15pm UTC](https://community.fibery.io/t/how-can-i-delete-a-duplicate-entry-automatically/1968 "2021-09-01T12:15:16Z")
**Posts on this page:** 7
**Page:** 1

<div class="post-metadata">

### Author: ![karthikk\_vijay](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/karthikk_vijay/32/1220_2.png) [@karthikk\_vijay](https://community.fibery.io/u/karthikk_vijay)
#### Post date: [September 1, 2021, 12:15pm UTC](https://community.fibery.io/t/how-can-i-delete-a-duplicate-entry-automatically/1968/1 "2021-09-01T12:15:16Z")

</div>

Hey everyone, nice to be a part of the fib fam 🙂

So, we import lots of data through CSV, and sometimes there might be duplicates from different files that get imported into the same type.

Is there a way that I can set up an automation which checks for duplicate name fields and then deletes one of them?

Thanks in advance

---

<div class="post-metadata">

### Author: ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)
#### Post date: [September 1, 2021, 4:47pm UTC](https://community.fibery.io/t/how-can-i-delete-a-duplicate-entry-automatically/1968/2 "2021-09-01T16:47:37Z")

</div>

hey there, and glad to have you in the fib fam 😉

When you have duplicates, does it matter which one gets deleted?  
Is it enough to assume that they are duplicates if the name is the same?  
Does the name have to match exactly, or does name=Name=NAME for example?

---

<div class="post-metadata">

### Author: ![karthikk\_vijay](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/karthikk_vijay/32/1220_2.png) [@karthikk\_vijay](https://community.fibery.io/u/karthikk_vijay)
#### Post date: [September 1, 2021, 5:57pm UTC](https://community.fibery.io/t/how-can-i-delete-a-duplicate-entry-automatically/1968/3 "2021-09-01T17:57:24Z")

</div>

I think for this specific issue at hand :

1. it doesn’t matter which one gets deleted
2. Yes, lets just say the names can be used to identify the duplicates
3. Name has to match exactly

I think the best thing would be if while importing fibery told me which ones are duplicate and then I could choose what the best course of action would be from there after reviewing. But if that’s not possible then setting up an automation that deletes these duplicates might be best.

Thanks!

---

<div class="post-metadata">

### Author: ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)
#### Post date: [September 1, 2021, 6:31pm UTC](https://community.fibery.io/t/how-can-i-delete-a-duplicate-entry-automatically/1968/4 "2021-09-01T18:31:57Z")

</div>

It’s actually quite difficult to do automatically, but there is a workaround way of highlighting duplicates:

Create a many-to-many auto-relation to the type itself, where the criteria for a match is Name = Name:  
e.g. for the Task type:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/a/a36da5f53e31624322037563e280a9d71120d829.png)

Then create a formula that counts the number of tasks (or whatever) with the same name:

![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/c/c56f757ec0bb691802bae57e2ada3b30574b5148.png)

When looking at a view of the entities

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/8/80ac17e4085429baded08b9a152f091485602854.png)

adding a filter will make it easy to see the duplicates:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/4/4d526913ad622b4afefa137d39218f21afb88621.png)

I think adding a duplicate check on CSV import would be a nicer solution, but until that’s available, this was the best I could come up with 🤔

---

<div class="post-metadata">

### Author: ![karthikk\_vijay](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/karthikk_vijay/32/1220_2.png) [@karthikk\_vijay](https://community.fibery.io/u/karthikk_vijay)
#### Post date: [September 2, 2021, 3:09am UTC](https://community.fibery.io/t/how-can-i-delete-a-duplicate-entry-automatically/1968/5 "2021-09-02T03:09:32Z")

</div>

That’s some great logic work there @Chr1sG 🙂 thanks for this, I think this could work for the time being 🙂

There’s still one problem though, that filter is going to list all the duplicates including one original copy that I would like to leave behind. So I guess I would still have to manually go through and delete them carefully. If there was a way to leave behind one of them and filter out all extra copies in a view, then it would be much easier to batch select and delete things.

---

<div class="post-metadata">

### Author: ![Chr1sG](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/chr1sg/32/3941_2.png) [@Chr1sG](https://community.fibery.io/u/Chr1sG)
#### Post date: [September 2, 2021, 6:45am UTC](https://community.fibery.io/t/how-can-i-delete-a-duplicate-entry-automatically/1968/6 "2021-09-02T06:45:03Z")

</div>

Well, here’s another neat little trick that will allow you to select only one of the duplicate items:

Create a formula field as follows:  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/b/b6f11703214839e4bfb7afaa823a7209e66dbf8f.png)

This will be true for all but the oldest of the duplicates:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/4/4b451480936438f1ac5eed83e5a5564c4e74f9f3.png)

You can now filter on this flag and all but one of the entities in each group of matches will be shown:

 ![image](https://us1.discourse-cdn.com/flex020/uploads/fibery/original/2X/6/6224d0ac2f29a1cc1c37286ee765ad893b5bee71.png)

These can now be safely deleted 🙂

---

<div class="post-metadata">

### Author: ![Matt\_Blais](https://sea2.discourse-cdn.com/flex020/user_avatar/community.fibery.io/matt_blais/32/1464_2.png) [@Matt\_Blais](https://community.fibery.io/u/Matt_Blais)
#### Post date: [July 6, 2022, 3:55pm UTC](https://community.fibery.io/t/how-can-i-delete-a-duplicate-entry-automatically/1968/7 "2022-07-06T15:55:37Z")

</div>

**Related:** Check this post for (among other things) a script that does entity de-duplication using the GraphQL API:

> [@Centralized script management for Workspace](https://community.fibery.io/t/centralized-script-management-for-workspace/3039/3):
>
> 100% agree! A lot of my requests here are directly related to this. Here are some things I can’t currently do with no-code: “Reach through” a Lookup to update the referenced entity. Change the Status of a related entity. Use References to look up a related entity: // If a Task's "Project" field is uninitialized, and there is a "Meeting Notes" // that references the Task, set the Task's "Project" field from the MN's "Default Project". // Script parameters const ENTITY\_LINK\_FIELD = 'Project' …
