
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 04, 2023 08:17 AM
Change
await table.deleteRecordAsync(recordId);
to
await table.deleteRecordsAsync(recordId);
And that should work fine

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 06, 2023 06:36 PM
Hi Adam, thanks for your solution.
adding 's' to the script seems to work but now I get different error sign :
ERROR
at main on line 4
number of items to delete can be from 0 to 500 sometimes.
Please help!
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
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

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apr 07, 2023 05:42 AM
This worked!!! thank you sooooooo much!😀
