Help

Extension working only for some records and not for others

Topic Labels: Extensions
Solved
Jump to Solution
1416 4
cancel
Showing results for 
Search instead for 
Did you mean: 
Praveen_Jain
4 - Data Explorer
4 - Data Explorer

I am new to Airtable. I am on free tier now.
I have an extension to run a script - essentially for lookup. I am using a script for lookup as my base needs two conditions for reference and I cannot use the native Lookup functionality.
My issue is that the script works perfectly for the first 15 records. The script stops working from record 16 onwards (I have total 29 records currently).
To check whether there was anything wrong in records 16-29 that was causing trouble, I copied the base, deleted the first 15 records and ran the script. The script worked perfectly in the copied base on the remaining records (erstwhile record no. 15-29). I am quite perplexed. Can anyone guide me why is this happening. I checked if I had exceed the record limit. The total records across tables in my base adds up to ~600.

Thanks in advance for helping

1 Solution

Accepted Solutions
kuovonne
18 - Pluto
18 - Pluto

Welcome to the Airtable community!

You are running into a rate limit. You are only allowed to submit up to 15 requests per second.

For now, the easiest fix is to put the await keyword in front of this line that submits the update request. This is also why you are not seeing the error—the script ends before it gets the error.

Eventually you will want to learn how to submit your requests in batches of 50. A bit later you may also want to learn how to build an index so you do not need the nested loops. Both of those techniques will make the script faster, which is important if you ever get a pro account and want to run the script as an automation.

See Solution in Thread

4 Replies 4

Welcome to the community, @Praveen_Jain! :grinning_face_with_big_eyes: Would you mind sharing the script that you’re using? It’s tough to know what’s happening without seeing the script details. When sharing the script, please format the code using the preformatted text option in the comment editor toolbar (the button looks like this: </>)

Thanks Justin for replying
Below is the code. I hope I have use the correct preformat for code.

let mainTable = base.getTable("Txn");
let mainTableRecords = await mainTable.selectRecordsAsync({fields:["MapIdentifier"]});

let lookupTable = base.getTable("Typ_Act_Map");
let lookupRangeRecords = await lookupTable.selectRecordsAsync({fields:["MapID","AccountsID"]});

for (let record of mainTableRecords.records) {
    let lookupValue = record.getCellValue("MapIdentifier");

    for(let rangeRecord of lookupRangeRecords.records) {
        if (rangeRecord.getCellValue("MapID") === lookupValue) {
            let linkID = rangeRecord.id;

            mainTable.updateRecordAsync(record, {
                "SuggestedID_Lkp_Ref": [{id: linkID}]
            });
        }
    }
}

kuovonne
18 - Pluto
18 - Pluto

Welcome to the Airtable community!

You are running into a rate limit. You are only allowed to submit up to 15 requests per second.

For now, the easiest fix is to put the await keyword in front of this line that submits the update request. This is also why you are not seeing the error—the script ends before it gets the error.

Eventually you will want to learn how to submit your requests in batches of 50. A bit later you may also want to learn how to build an index so you do not need the nested loops. Both of those techniques will make the script faster, which is important if you ever get a pro account and want to run the script as an automation.

Thank you so much. await keyword helps and I am able to get the desired results for all the records now.
I am new to scripting and still learning
Will learn how to build and index