Re: Automations: Deleting a record

2534 6
Showing results for 
Search instead for 
Did you mean: 
4 - Data Explorer
4 - Data Explorer

I was wondering if it was possible to setup an automation that would auto delete a record with a specific single-select field entry after 30 days or something.

10 Replies 10

Hi @Jeffrey_Yau - Airtable automations don’t currently have a delete action, but you can do the following:

When a record enters a view => Run a script

The view would be defined as:

  • Single select field = ‘XXXX’ and
  • Last modified date > 30 days ago

The script would take the record from the trigger and delete it - see here for more details:

8 - Airtable Astronomer
8 - Airtable Astronomer

Hi :wave: , this is an old post, but I will leave this solution for other people looking for it.

You can use this code inside the automations in a “Run script” step:

let inputConfig = input.config();
const id =;
const Table = base.getTable(inputConfig.Table);
await Table.deleteRecordAsync(id);

You then configure “Table” & “id” as input variables, “Table” is the name of the table of the record, and “id” is the Record ID that regularly will come from a previous step.

This step will delete the record with that record id.

You then configure “Table” & “id” as input variables

Hello @SergioCodes , I am trying to use the code you posted above but with little luck. I don’t know how to set up the variables and I get

TypeError: Invalid arguments passed to base.getTable(idOrName): • idOrName should be a string, not undefined

could you elaborate a little?


Happy to help, just change this line:

const Table = base.getTable(inputConfig.Table);


const Table = base.getTable("TableName");

Where “TableName” is the name of your table and it should work

@SergioCodes Thank you!

Hey, I am not sure what I am doing incorrect. I have no idea how scripts work.

Can you please help me?

You cut off the right side of the screen in your screen shot. What does it say?

Are you getting an error when you run the script? Have you tried retesting the trigger to get a new record ID? If you have already deleted the record, you cannot delete it again.

What is the value of your id? The script won’t work unless it is exactly one Airtable record ID. E.g. it won’t work if there are no IDs in the input variable, and it won’t work if there are multiple record IDs, and it won’t work if the IDs are not Airtable record IDs.

By the way as a matter of styling, it is customary to start variable names with a lower case letter, so Table would be table. However, this is not what is causing your issues.

Thank you for the response.

My previous step is “Find Record” which will always fine one record alongwith its record id.

It is actually one record id only but I assume, since find record module gets array of the records (whether one record or more than one), it may not be working. I tried putting actual record id, it was working properly.

Any specific solution?

No specific solutions. But try console.log(id) to see what the actual value is. Then also search your table for a record with that id. Those two bits of information should help troubleshoot.