Help

Upcoming database upgrades. to improve our reliability at 03:30 UTC on Feb. 25 / 7:30pm PT on Feb. 24. Some users may briefly experience slow load times or error messages. Learn more here

Airtable Automation/Script to Delete Record

Topic Labels: Scripting extentions
940 9
cancel
Showing results for 
Search instead for 
Did you mean: 

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?

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

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.

that did it! thanks!