Jul 28, 2021 08:49 AM
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
Jul 28, 2021 09:02 AM
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"}]
Jul 29, 2021 01:51 AM
Thanks for your help.
proposedgames
= [“recXXXXX1”, “recXXXXX2”, “recXXXXX3”]
With a for I have created the array of object and I have resolved my issus.