How to Automatically Delete Airtable Records

How to Automatically Delete Airtable Records

Introduction

Today, we are going to show you how to automatically delete Airtable records using the Run Script automation action.

 

In the video at the end of this blog, I show you how I delete records in a particular Airtable base and trigger their deletion using a condition that fires daily based on the record ‘Created Date’.

 

 

First Up

In the video, you’ll see I have a table with 4 records and I’m going to show you how to automatically delete each one of them individually using Airtable automation.

 

Going into the Automations tab, you’ll see that it’s triggered when a record matches conditions. I’ve got it set so that it triggers everyday based on the date the record was created.

 

 

Airtable ‘Run Script’ Action

If we go into the next step which is the ‘Run Script’ action, I have an input field which is the record ID from the previous step and the code which states the table name and the record ID from the previous step.

 

 

Test Automation

If we go into the first step and choose a record for testing, it should say successful if it can find a record which matches the conditions.

 

We then go to the next step and test the ‘Run Script’ action, and you’ll see that it has successfully deleted the record.

 

If we go back to the table you’ll see that the record has been deleted. Here’s the script.

 

let table = base.getTable("Your Table Name")
await table.deleteRecordAsync(input.config()['record_id']);

 

And that’s it for today! If you’re new to Airtable, sign up for an Airtable account here.

 

If you’ve got any questions, feel free to send us an email using our Contact form. Watch our video below and remember to hit the like and subscribe buttons.

 

Learn how to create Clickup assets from Airtable in this blog post.

Video

Play Video about How to Automatically Delete Airtable Records