Help

Re: Error: {name: "j"}

3537 2
cancel
Showing results for 
Search instead for 
Did you mean: 
marco_ncode
5 - Automation Enthusiast
5 - Automation Enthusiast

Hi everyone!

I have a schema of 252 records to apply to some client in a standardized order. This is the script I made (deleted different lines because of number of characters:

 

 

 

let duplicaTable = base.getTable("Duplica_Form")
let tyrecords = await duplicaTable.selectRecordsAsync({fields: ["Dashboard Clienti"]})
let cliente = tyrecords.records.filter(item => item.getCellValue("Dashboard Clienti"))
//console.log(cliente)

let arrayTypeform = []
    cliente.forEach(item => {
    arrayTypeform.push(    
    {fields: {"order": 1, "typeform":[{id:"recg1yUeuxfjKfn0t"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 2, "typeform":[{id:"rec0TnCthwKaCsBcF"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 3, "typeform":[{id:"recg9NPL21ZWduc5g"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 4, "typeform":[{id:"reck4nzT8lp9Us5Nx"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 5, "typeform":[{id:"recPSIR9XZUw6wvNX"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 6, "typeform":[{id:"recG4IQkwSqdtjWsi"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 7, "typeform":[{id:"rec5SDIuYxsVbbO9f"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 8, "typeform":[{id:"reccICtkfmxCnbJab"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 9, "typeform":[{id:"recAenv79pdNIntqT"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 10, "typeform":[{id:"rec35jcUxc1O5sn9L"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 11, "typeform":[{id:"recmDhugMy4UpbqCs"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 12, "typeform":[{id:"recXJZehux22C2S57"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 13, "typeform":[{id:"recnC2Upgr6BbhFfy"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 14, "typeform":[{id:"rec4DZgyCASCkEoio"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 15, "typeform":[{id:"recvtPxlJLXC7jwNs"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 16, "typeform":[{id:"recQwPZ82tC2qkWjT"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 17, "typeform":[{id:"reczgtgRBn1YFtF5z"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 18, "typeform":[{id:"recJudomc0SFJhjeN"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 19, "typeform":[{id:"recLo4I7SeZVMeTc1"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 20, "typeform":[{id:"recU8OneRGuIVJ2bj"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 21, "typeform":[{id:"recDavLKhqWul6sto"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 22, "typeform":[{id:"recS4oSSgTexttzLu"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 23, "typeform":[{id:"recGa8tfMpbCniNX8"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 24, "typeform":[{id:"recnRPVuZbfepXP1u"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 25, "typeform":[{id:"rec0roH1kx36cgEy7"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 26, "typeform":[{id:"rec8BWXEBVfymuPAM"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 27, "typeform":[{id:"reckPeYtQgW1efyOA"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 28, "typeform":[{id:"rec8CeGx4PSr4ljAu"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 29, "typeform":[{id:"recsHvA8t6nxcQVFA"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 30, "typeform":[{id:"reccThOzWfmntxEhk"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 31, "typeform":[{id:"rech3RtNkUMhFYB8K"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 32, "typeform":[{id:"rec3UaVs1HA0SCZGC"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 33, "typeform":[{id:"recUGgPzWrnSqrDO9"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 34, "typeform":[{id:"rec36AAj9UyrizpJn"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 35, "typeform":[{id:"recIA1FCF3UlAoohC"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 36, "typeform":[{id:"recyoTJPixU0wjMJn"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 37, "typeform":[{id:"recs7MfFrtNzPXDfr"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 38, "typeform":[{id:"recckoE7dsSisvoU9"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 39, "typeform":[{id:"recqr3RirVQOFKF64"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 40, "typeform":[{id:"recwlYRUvfzisJtDB"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 41, "typeform":[{id:"recCuRpvk32wBTXtk"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 42, "typeform":[{id:"rec527yYiOZfQ7m3x"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 43, "typeform":[{id:"recf0nAq0LKxJQmPL"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 44, "typeform":[{id:"recWZ1TKdwnm61mIJ"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 45, "typeform":[{id:"reciQMCMjW0Nk6oiU"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 46, "typeform":[{id:"recdiefs5SkJUvf9W"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 47, "typeform":[{id:"recBvOVe1Aeuzlsin"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 48, "typeform":[{id:"rec6WXN1CzfStBYHe"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 49, "typeform":[{id:"recV44bBC1gTjYrDD"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 50, "typeform":[{id:"reclapv3o7EdWZhgG"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 51, "typeform":[{id:"recWvfBTbwvua4IbW"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 52, "typeform":[{id:"recQiUPd78a2vHYnm"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 53, "typeform":[{id:"recprcmTGHTI13xwX"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 54, "typeform":[{id:"rec700gmUwZnkxRcs"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 55, "typeform":[{id:"recw5B0Yl0HX3qFfs"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 56, "typeform":[{id:"recnGtltxT4G5Vzlv"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 57, "typeform":[{id:"recDI4bVcGMyDyffB"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 58, "typeform":[{id:"recO8KMih1uK9H8zJ"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 59, "typeform":[{id:"recWwg5H5T86w0Aq5"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 60, "typeform":[{id:"recNxLEMWPBBX1Bj4"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 61, "typeform":[{id:"recaImnUXbQa1cyj8"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 62, "typeform":[{id:"recUi33df0WMDugPj"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 63, "typeform":[{id:"rechrkV0T4pvNTvR3"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 64, "typeform":[{id:"rec8HUJryxeHYB1ET"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 65, "typeform":[{id:"recGUkHZ5fYHn8DcJ"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 66, "typeform":[{id:"recRPEy1imC5vx7Bs"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 67, "typeform":[{id:"rec1MMDQaQBFuq4Nt"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 68, "typeform":[{id:"rec4Sd7XVKeut0tdW"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 69, "typeform":[{id:"recMbwOcYfbUcJ8Ax"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 70, "typeform":[{id:"recSAcs1ommx9usBN"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 71, "typeform":[{id:"recUldDIul5IxYJ8F"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 72, "typeform":[{id:"recaFwxTri7awte2P"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 73, "typeform":[{id:"recyN0H7R4uWiS1pe"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 74, "typeform":[{id:"recNE7u75L05o2yDr"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 75, "typeform":[{id:"recskayDqCEXFebTL"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 76, "typeform":[{id:"recyFGZsFJaVYQgDi"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 77, "typeform":[{id:"recUSGX1ATqdQYcVv"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 251, "typeform":[{id:"recSka2pxPNhlsqe1"}],"duplica_form": [{id: item.id}]}},
    {fields: {"order": 252, "typeform":[{id:"recx9qOV39cWWcnJ7"}],"duplica_form": [{id: item.id}]}}
    )
    })

console.log(arrayTypeform)

let table = base.getTable("Crea Typeform");

while (arrayTypeform.length) {
    const recordsSplice = arrayTypeform.splice(0, 50);
    console.log(recordsSplice); // debug print
    try {
        await table.createRecordsAsync(recordsSplice);
    } catch (error) {
        console.error('Failed to create records:', error);
        console.error('Error details:', JSON.stringify(error, null, 2));
        break;  // Stop the loop if there's an error.
    }
}

 

 

 

 

 

I got this error and I don't know why.

Screenshot 2023-05-21 alle 19.37.40.png

The first 50 records are created correctly.

8 Replies 8
MLO
6 - Interface Innovator
6 - Interface Innovator

I am far from a scripting expert, but I'm pretty sure you can only do batches of 50 at a time.  There are ways to set up your script to do this. I don't know exactly how but I know there are plenty of examples out there if you do a search.

I don't think it is an issue of creating records in batches of 50. The script already breaks down the records to create into batches of 50.

The error message isn't particularly helpful. However, if you can consistently trigger the error, can you isolate the one specific record that is triggering the error? Then examine what is different about that record?

Hi, the problem is that the log is always the same, name: j or something very similar. And literally I don't know how to get different information. Also, record 51 is very similar to the others which had no problems.

 

ASP-14recXXXXXASP"multiple_choice"texttexttexttext
ASP-15recXXXXXASP"multiple_choice"texttexttexttext

You can try removing the try/catch and let the script fail naturally and see if you get a different error message.

 

You can also try smaller batches. The problem is not necessarily with the 51st record. It could be any of the records in the second batch. For example, are you sure that the record ID that you are trying to link to actually exists and hasn't been deleted?

Got a new error, that make also no sense to me:

j: Can't create records: invalid cell value for field 'typeform'. Cell value has invalid format: <root>.0.id must be an objectId. Linked records field value must be an array of objects with property 'id' corresponding to linked record id.

With a batch of 20, it wrote 80 record. Also it stopped ad 80 with a batch of 5.

The error should be from 81 to 85 but there is nothing strange in these records:

Immagine 2023-05-22 092555.png

marco_ncode
5 - Automation Enthusiast
5 - Automation Enthusiast

[SOLVED] A record id was bad written. I could notice it thanks to @kuovonne advice!

ffeugas
4 - Data Explorer
4 - Data Explorer

Hi,

I've the same type of error... I tried a very simple test, with 3 IDs to add. If I do this manually directly in the table, it works. But through the script, not.

Here is my code :

// Accéder à la table
let table = base.getTable("Dispo JOP copy");

// Définir le tableau d'ID à insérer comme des liens d'enregistrement
let idsToLink = ["recDgqF8Mn9k8jgJf", "recdbE8zjcAAiD984", "rec4fIrsbub1HWwCI"];

try {
    // Mettre à jour l'enregistrement spécifique en utilisant un tableau pour le champ de lien
    await table.updateRecordAsync("recmsAPtIRhsdlDe7", {
        "Personnes dispo 22": idsToLink // Assurez-vous que ceci correspond au champ de lien correct
    });

    console.log("Mise à jour effectuée avec succès.");
} catch (error) {
    console.error("Erreur lors de la mise à jour:", error);
    console.log("Contenu tenté d'être inséré:", idsToLink);
    console.log("Trace de la pile de l'erreur:", error.stack);
}

 And the logs :

CONSOLE.ERROR
"Erreur lors de la mise à jour:"
Error {name: "a"}
CONSOLE.LOG
"Contenu tenté d'être inséré:"
(3) ["recDgqF8Mn9k8jgJf", "recdbE8zjcAAiD984", "rec4fIrsbub1HWwCI"]
0: "recDgqF8Mn9k8jgJf"
1: "recdbE8zjcAAiD984"
2: "rec4fIrsbub1HWwCI"
CONSOLE.LOG
"Trace de la pile de l'erreur:"
"Error: Field "fldFelfV84P3cYUAt" cannot accept the provided value.
    at I._fetchAsync (/opt/nodejs/airtable_libs/scripting_lambda_layer.js:2:2443402)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async /opt/nodejs/airtable_libs/scripting_lambda_layer.js:2:2444558
    at async /opt/nodejs/airtable_libs/scripting_lambda_layer.js:2:2440378
    at async S.enqueueTaskAsync (/opt/nodejs/airtable_libs/scripting_lambda_layer.js:2:2440421)
    at async I.updateRecordsAsync (/opt/nodejs/airtable_libs/scripting_lambda_layer.js:2:2444337)
    at async updateRecord (/opt/nodejs/airtable_libs/scripting_lambda_layer.js:2:88891)
    at async c._handleCallAsync (/opt/nodejs/airtable_libs/scripting_lambda_layer.js:2:2895715)
    at p.updateRecordAsync (<isolated-vm>:2:36884)
    at main (script.js:9:17)
    at script.js:20:3"

I don't get it...

 

I checked if the Record ID of the line I try to update was wrong, but I get it throught the formula directly : "RECORD_ID()"... so... I even tried to replace his ID by the content of the first column, but same error.