Hi @Jeffrey_Yau - Airtable automations don’t currently have a delete action, but you can do the following:
When a record enters a view => Run a script
The view would be defined as:
The script would take the record from the trigger and delete it - see here for more details:
Hi :wave: , this is an old post, but I will leave this solution for other people looking for it.
You can use this code inside the automations in a “Run script” step:
let inputConfig = input.config(); const id = inputConfig.id; const Table = base.getTable(inputConfig.Table); await Table.deleteRecordAsync(id);
You then configure “Table” & “id” as input variables, “Table” is the name of the table of the record, and “id” is the Record ID that regularly will come from a previous step.
This step will delete the record with that record id.
You then configure “Table” & “id” as input variables
Hello @SergioCodes , I am trying to use the code you posted above but with little luck. I don’t know how to set up the variables and I get
TypeError: Invalid arguments passed to base.getTable(idOrName): • idOrName should be a string, not undefined
could you elaborate a little?
You cut off the right side of the screen in your screen shot. What does it say?
Are you getting an error when you run the script? Have you tried retesting the trigger to get a new record ID? If you have already deleted the record, you cannot delete it again.
What is the value of your id? The script won’t work unless it is exactly one Airtable record ID. E.g. it won’t work if there are no IDs in the input variable, and it won’t work if there are multiple record IDs, and it won’t work if the IDs are not Airtable record IDs.
By the way as a matter of styling, it is customary to start variable names with a lower case letter, so
Table would be
table. However, this is not what is causing your issues.
Thank you for the response.
My previous step is “Find Record” which will always fine one record alongwith its record id.
It is actually one record id only but I assume, since find record module gets array of the records (whether one record or more than one), it may not be working. I tried putting actual record id, it was working properly.
Any specific solution?