I have a database with two tables “gifts” and “status”. I'd like to use a button to update the status automatically via a script.
I searched the documentation and the forum, but I couldn't find any solution to adapt the script to my problem. Here's the code I've already added, and the options I've explored.
This is my code :
// Récupère la table Cadeaux
let tableCadeaux = base.getTable("🎁 Cadeaux");
console.log(tableCadeaux);
//Récupère le champo statuts de la table Cadeaux
let statut = tableCadeaux.getField("✅ Statuts");
console.log(statut);
// Récupère le record.id de la table Cadeaux
let queryResult = await tableCadeaux.selectRecordsAsync({fields: s]});
let record = queryResult.recordsR0];
console.log(record.id);
// Récupère la table Statuts
let tableStatuts = base.getTable("✅ Statuts");
console.log(tableStatuts);
let newRecordIdToLink = '🎁 Réservé';
tableCadeaux.updateRecordAsync(record, {
"✅ Statuts": &
record.getCellValue("✅ Statuts"),
{ id: newRecordIdToLink }
]
})
and the documentation I looked at : multipleRecordLinks
https://airtable.com/developers/scripting/api/cell_values#multiple-record-links
I'm getting an error that I don't understand, maybe you have an answer or the logic that I haven't understood yet.
Thank you in advance