Skip to main content

Creating automation for deleting duplicates

  • January 12, 2023
  • 3 replies
  • 192 views

Forum|alt.badge.img+1

Hi, 

I want to write a script that automatically deletes duplicates as soon as something new is added to the table. Basically it should work similar to the Dedupe extension, but be automated to save time.
I only want to delete rows which are identically in each field. It's my first time trying to automate a function with Airtable. I would appreciate if any one has some ideas how to get started with the script or maybe has even written something similar before.

Thank you for your help!

3 replies

Forum|alt.badge.img+6
  • Known Participant
  • 12 replies
  • December 1, 2023

Did you ever find a solution? I'm looking for a similar solution.


Forum|alt.badge.img+3
  • Participating Frequently
  • 8 replies
  • March 22, 2024

 same here


Forum|alt.badge.img+6
  • Known Participant
  • 12 replies
  • March 25, 2024

I was able to find a solution that worked for my situation. In my case, the trigger is a form being submitted. I'm not sure how you would manage it if you're entering the data directly into an Airtable base. 

Here's my steps: 

Trigger: When a form is submitted

First Action: Find records where Task Record ID is Parent Record ID (we prefill the form so that these two will always match)

Second Action: Run script. (I found the base script in another thread, but I don't have that one handed right now)

let table = base.getTable("Tasks");
let inputConfig = input.config();
let recordId = inputConfig['recordId']
await table.deleteRecordAsync(recordId);
 
Third Action: Update record. It is conditional based on whether or not there's already an attachment in the attachment field, but the basic functionality is the same in both cases: Update the found record from Action 1 with the attachment that was uploaded via the form and mark the task completed. (This does work even though you've technically already deleted the new record in Action 2.)