Help

Re: Delete a record by automation

Solved
Jump to Solution
1482 0
cancel
Showing results for 
Search instead for 
Did you mean: 
ido
4 - Data Explorer
4 - Data Explorer

I am looking to Run a script in an Action. basically whenever the Category “Done” or “Postpone” is set to the record by single select field. I like to run a script that deletes those records. The trigger is pretty much easy to do by the automation configuration. The script is the one I didn’t figure out how to do.

1 Solution

Accepted Solutions

Thank you for the clarification that you wanted a free script.

Here is a simple script. You need to edit the script to match the name of your table.
You also need to create an input variable for the automation named recordId with the value of the record id of the triggering record from step 1.

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

See Solution in Thread

8 Replies 8

Welcome to the Airtable community!

You need to call deleteRecordAsync() on the table to delete the record.

How do I write a script that will delete a record that has “Done” value in it ?
single select field with “Done”.

Are you having trouble getting your script to work, or do you have trouble getting started?

If you have trouble getting you code to work, please post what you have and the community can help you debug.

If you do not know where to start, decide if you want to learn to write scripts, or if you just want working code.

If you want to learn to write scripts, tell us your current coding experience and we can point you to resources.

If you just want working code, please say if you are looking for someone to give you the script for free, or if you have budget to hire someone.

Actually I have zero experience with coding.
whatever I try to do doesn’t work.

I would appreciate if someone could write the script.

Do you have budget to hire someone to write the script, or are you looking for a free script?

I looking for a free one.

Thank you for the clarification that you wanted a free script.

Here is a simple script. You need to edit the script to match the name of your table.
You also need to create an input variable for the automation named recordId with the value of the record id of the triggering record from step 1.

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

thank you so much.
It work after a little playing around.