Help

Re: Airtable Automation/Script to Delete Record

2701 3
cancel
Showing results for 
Search instead for 
Did you mean: 
Charri_Lara
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi, I’d like to delete a record when a checkbox is selected. I’ve set up the automation but have zero knowledge of scripts. What is missing here?

let table = base.getTable("Room Reservations");
let inputConfig = input.config();
let recordId = inputConfig['recordId']
await table.deleteRecordAsync(recordId);```

Thanks so much
9 Replies 9

Welcome to the Airtable community!

Have you set up recordId as the input variable for the script?

Have you setup the trigger for the automation?

Charri_Lara
5 - Automation Enthusiast
5 - Automation Enthusiast

@kuovonne Thank you!
I set up the input variable and it worked like magic, thanks.

Tricia_Springfi
5 - Automation Enthusiast
5 - Automation Enthusiast

hi - i have this and i keep getting an error:

let table = base.getTable(“Vibe Stages”);
let inputConfig = input.config(recordId);
let recordId = inputConfig[‘recordId’]
await table.deleteRecordAsync(recordId);

ReferenceError: Cannot access ‘recordId’ before initialization
at main on line 2

Welcome to the Airtable community!
You have copied the script incorrectly. Look at the second line of the script.
You want …

let table = base.getTable("Vibe Stages");
let inputConfig = input.config();
let recordId = inputConfig['recordId']
await table.deleteRecordAsync(recordId);

Thanks! when i do that i get this error
Screenshot_5

Did you create your input variable?

how do i do that? i thought the record id was the variable

You have to setup the input variable in the left section of the script editor. There is a link in that section to more documentation if you need more help.

Tricia_Springfi
5 - Automation Enthusiast
5 - Automation Enthusiast

that did it! thanks!