Batch update gives duplicate error

Topic Labels: Scripting extentions
531 0
Showing results for 
Search instead for 
Did you mean: 
4 - Data Explorer
4 - Data Explorer


I’m working on a script to batch update linked fields and it seems to work for the most part but eventually throws this error:
Screen Shot 2022-07-14 at 10.48.36 AM

I have checked for duplicates in the tables I’m working with but there are none. Any ideas what might be causing this? Here’s the script for reference:

//Define the company table and query
let cmpTbl = base.getTable("Companies");
let cmpQuery = await cmpTbl.selectRecordsAsync();

//Define people table and query
let pplTbl = base.getTable("People");
let pplQuery = await pplTbl.selectRecordsAsync();

let updates = [];

// Search for matching records and batch update
for (let allPeople of pplQuery.records){
    let cmp = allPeople.getCellValue("Company")
    for (let allCompanies of cmpQuery.records){
        if (cmp === allCompanies.getCellValueAsString("Company")) {
            let cmpID =

                fields: {"Companies 2.0": [{id: cmpID}]} 


while (updates.length > 0) {
    await pplTbl.updateRecordsAsync(updates.slice(0, 50));
    updates = updates.slice(50);

0 Replies 0