Help

Discover what data silos are costing your org in our commissioned Forrester study. Learn more

updateRecordAsync for multipleRecordLinks

Topic Labels: Scripting extentions
505 2
cancel
Showing results for 
Search instead for 
Did you mean: 

Hi

I need your help today.
I would like write a script to update à LinkToFild with multiple Record Links. I write this script but “await tableLudique.updateRecordAsync” doesn’t work.
Can you help me ?

let inputConfig = input.config();
let rentedgames = inputConfig.listingrent;
let proposedgames = inputConfig.listingpropose;
let tableLudique = base.getTable("Profil Ludique");
let recordsPulpo = await base.getTable("Liste jeux de PulpoLudo").selectRecordsAsync();
let record = inputConfig.record;

console.log(proposedgames);
console.log(rentedgames);

for (let rentedgame of rentedgames) {
    for (let proposedgame of proposedgames) {
        if (proposedgame == recordsPulpo.getRecord(rentedgame).getCellValue("Référence")[0].id) {
            proposedgames.splice(proposedgames.indexOf(proposedgame), 1); 
        };
    };
};

console.log(proposedgames);
console.log(rentedgames);

await tableLudique.updateRecordAsync(record, {
    "liste des jeux à proposer": proposedgames,
});

Thanks for your help

2 Replies 2

You’re console logging the proposedgames variable, what output is it showing?

A Link to Another Record-type field needs an input that is an array of objects with a single property of the record ID, which would look like this:

[{id: "recXXXXX1"}, {id: "recXXXXX2"}, {id: "recXXXXX3"}]

Thanks for your help.
proposedgames = [“recXXXXX1”, “recXXXXX2”, “recXXXXX3”]
With a for I have created the array of object and I have resolved my issus.