Help

Creating automation for deleting duplicates

832 3
cancel
Showing results for 
Search instead for 
Did you mean: 
emelyxerdbeere
4 - Data Explorer
4 - Data Explorer

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 3
Anne_Gonzalez
5 - Automation Enthusiast
5 - Automation Enthusiast

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

Cristiano_Volpi
5 - Automation Enthusiast
5 - Automation Enthusiast

 same here

Anne_Gonzalez
5 - Automation Enthusiast
5 - Automation Enthusiast

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.)