Skip to main content

How to guide: Deleting a record with an automation

  • November 5, 2025
  • 4 replies
  • 40 views

TheTimeSavingCo
Forum|alt.badge.img+31

Here’s a quick guide on how to create an automation that deletes records automatically!  (Needs a paid plan for access to the Run a Script automation action)

Possible use cases include:

  1. Records over a year old to be cleared out automatically
  2. Deleting flagged duplicates
  3. Resetting daily / weekly logs for reporting, etc

 

I’ve put together an example base where everything’s set up for reference, and here’s a gif of the automation running.
 

 

First, we’ll create an automation that triggers when the ‘Delete’ checkbox is ticked, and add a Run a Script action to it:

 

We’ll then paste in the following code:

let {recordId, tableId} = input.config()

await base.getTable(tableId).deleteRecordAsync(recordId)

The code uses `recordId` and `tableId`, so we’ll define those as input variables by clicking ‘Add input variable’ on the left:

You can see how we typed in ‘recordId’ and ‘tableId’ manually, then selected the appropriate option via the dropdown menu

 

For ‘recordId’, we select the record ID of the triggering record like so:

 

And for the tableId, we select the table that we want to delete records from, in this case, the ‘Projects’ table:
 

 

 

And that's pretty much it!  Your Run a Script action should look like this now and you can turn on the automation to test it!

Optional but useful: The example base also includes an automation that deletes linked records automatically!

 

4 replies

Mike_AutomaticN
Forum|alt.badge.img+28

Hey ​@TheTimeSavingCo,

This is really helpful and the script provided is really lean (which is great for non-coders).

Three additional comments:

1. To spice things up a bit, a really frequent solution that I implement for clients is “cascade-deletion”. E.g. if Delete checkox is clicked for a given Invoice, script should delete all linked records for Invoice Line Items as well. I’ll try to share this script later today.

2. If any future reader would rather go with a no-code approach to this: Do know that automation platforms such as n8n have their own no-code modules/nodes for handling Airtable record deletion -see screenshot below. Make and Zapier probably have this as well. Depending on how you need to trigger this automation whether a script will be needed to run the webhook call or not!
 

 

3.It is crazy that Airtable does not include this action on the native automations. Make sure to submit that as a feature request using this Product Idea form

Completely different matter, but would love to have you join our Airtable Hackathon! Make sure to sign up!!

Mike, Consultant @ Automatic Nation 
YouTube Channel


TheTimeSavingCo
Forum|alt.badge.img+31
  • Author
  • Brainy
  • 6450 replies
  • November 5, 2025

E.g. if Delete checkox is clicked for a given Invoice, script should delete all linked records for Invoice Line Items as well. I’ll try to share this script later today.

Yeap, that’s part of the example base and it’s done via a repeating group!

 


DisraeliGears01
Forum|alt.badge.img+21

This is great Adam, I should keep it bookmarked for future reference when needed…

Actually ​@MaddieJ this makes me think of a forum feature that could be really handy (which goodness knows if it’s implementable within the current system), specifically if there’d be any way to Star or Favorite a thread for future reference. When you reply you get subscribed, and I suppose one could be judicious in unsubscribing, but I dunno, just struck me. There are numerous threads that I keep around for potential future reference.


Mike_AutomaticN
Forum|alt.badge.img+28

Nice ​@TheTimeSavingCo! Yesss. That is pretty much what I meant :D 

Completely different matter, but would love to have you join our Airtable Hackathon! Make sure to sign up!!

Mike, Consultant @ Automatic Nation 
YouTube Channel