Automations: Deleting a record

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.

1 Like

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:

4 Likes

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 = inputConfig.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.

3 Likes