Apr 04, 2021 07:59 AM
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.
Solved! Go to Solution.
Apr 05, 2021 10:06 AM
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);
Apr 04, 2021 08:31 AM
Welcome to the Airtable community!
You need to call deleteRecordAsync() on the table to delete the record.
Apr 05, 2021 01:46 AM
How do I write a script that will delete a record that has “Done” value in it ?
single select field with “Done”.
Apr 05, 2021 07:21 AM
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.
Apr 05, 2021 08:10 AM
Actually I have zero experience with coding.
whatever I try to do doesn’t work.
I would appreciate if someone could write the script.
Apr 05, 2021 08:29 AM
Do you have budget to hire someone to write the script, or are you looking for a free script?
Apr 05, 2021 08:53 AM
I looking for a free one.
Apr 05, 2021 10:06 AM
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);
Apr 05, 2021 01:18 PM
thank you so much.
It work after a little playing around.
May 15, 2023 06:10 AM
Hi team,
I'm getting the following error message when running the free script:
at main on line 4
Can anyone advise?
Thanks