Jan 17, 2022 12:35 PM
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
Jan 17, 2022 01:06 PM
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?
Jan 17, 2022 02:27 PM
@kuovonne Thank you!
I set up the input variable and it worked like magic, thanks.
Jan 19, 2022 10:12 AM
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
Jan 19, 2022 10:27 AM
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);
Jan 19, 2022 10:40 AM
Thanks! when i do that i get this error
Jan 19, 2022 10:45 AM
Did you create your input variable?
Jan 19, 2022 11:22 AM
how do i do that? i thought the record id was the variable
Jan 19, 2022 11:28 AM
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.
Jan 19, 2022 12:07 PM
that did it! thanks!