Skip to main content
Solved

automation : deleting arrays


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:

---------------------------------------------------------

let table = base.getTable("각종주문서수집");
let inputConfig = input.config();
let recordId = inputConfig['recordID'];
await table.deleteRecordAsync(recordId);
---------------------------------------------------------

 

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.

 

Best answer by TheTimeSavingCo

Jessica_Shin wrote:

Hi Adam, thanks for your solution.

adding 's' to the script seems to work but now I get different error sign :

ERROR

Error: Request exceeds maximum batch size limit of 50 items
    at main on line 4

 

number of items to delete can be from 0 to 500 sometimes.

Please help!

 


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

View original
Did this topic help you find an answer to your question?

4 replies

TheTimeSavingCo
Forum|alt.badge.img+18

Change 

await table.deleteRecordAsync(recordId);

to

await table.deleteRecordsAsync(recordId);

And that should work fine


  • Author
  • Participating Frequently
  • 5 replies
  • April 7, 2023
TheTimeSavingCo wrote:

Change 

await table.deleteRecordAsync(recordId);

to

await table.deleteRecordsAsync(recordId);

And that should work fine


Hi Adam, thanks for your solution.

adding 's' to the script seems to work but now I get different error sign :

ERROR

Error: Request exceeds maximum batch size limit of 50 items
    at main on line 4

 

number of items to delete can be from 0 to 500 sometimes.

Please help!

 


TheTimeSavingCo
Forum|alt.badge.img+18
Jessica_Shin wrote:

Hi Adam, thanks for your solution.

adding 's' to the script seems to work but now I get different error sign :

ERROR

Error: Request exceeds maximum batch size limit of 50 items
    at main on line 4

 

number of items to delete can be from 0 to 500 sometimes.

Please help!

 


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


  • Author
  • Participating Frequently
  • 5 replies
  • April 7, 2023
TheTimeSavingCo wrote:

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


This worked!!! thank you sooooooo much! 😀 


Reply