Apr 03, 2023 11:33 PM
I set up schedule automation to find records under certain condition and delete those records.
however, using script to delete the found records doesn't seem to work.
the script I'm using here is the following:
---------------------------------------------------------
when I test, this script kept throwing fail notice showing the 'recordID' of the input variable I made is an array not a record.
How can I change this to scipt to work with array of recordID ? or is there any way that I can select every record ID values instead of 'list of record ID'? I don't get any other options at the 'value' box an I assign the input.
Solved! Go to Solution.
Apr 07, 2023 03:49 AM
Hmm, try replacing that "await" line with:
while (recordId.length > 0) {
await table.deleteRecordsAsync(recordId.slice(0, 50));
recordId = recordId.slice(50);
}
"Find Records" has a max return limit of 100 records as well, so you're going to have to factor that in to your automation setup I believe
Apr 04, 2023 08:17 AM
Change
await table.deleteRecordAsync(recordId);
to
await table.deleteRecordsAsync(recordId);
And that should work fine
Apr 06, 2023 06:36 PM
Apr 07, 2023 03:49 AM
Hmm, try replacing that "await" line with:
while (recordId.length > 0) {
await table.deleteRecordsAsync(recordId.slice(0, 50));
recordId = recordId.slice(50);
}
"Find Records" has a max return limit of 100 records as well, so you're going to have to factor that in to your automation setup I believe
Apr 07, 2023 05:42 AM
This worked!!! thank you sooooooo much!😀