Hello everyone,
I am very new to scripting, so hoping I can get some support here.
In short, I am trying to use the "Find Records" automation action to get a list of records, and then pass that list onto the script to delete them. Below is what I have but am getting "TypeError: Invalid arguments passed to table.deleteRecordAsync(recordOrRecordId): • recordOrRecordId → recordOrRecordId should be a Record, not undefined or recordOrRecordId should be a string, not undefined"
I believe this is because the list is being passed to the script as a string, not a record, but am not certain that is the issue or how to rectify. Code is below, thanks in advance!
let table = base.getTable('Milestones');
let inputConfig = input.config();
let recordsToDelete = inputConfig.RecordList;
console.log(recordsToDelete);
for (let deleteRecord of recordsToDelete) {
await table.deleteRecordAsync(deleteRecord.id);
output.text(`Deleted record for ${deleteRecord.name}`)
}