Hello,
I am trying to transfer a collaborator field from one table to another. It works perfectly for the other text fields but for the collaborator field it doesn’t work.
"User (other)": { "id": user },
Doesn’t work
Here is my code :
let mainTable = base.getTable("Table 1");
let mainTableRecords = await mainTable.selectRecordsAsync();
let lookupTable = base.getTable("Table 2");
let lookupRangeRecords = await lookupTable.selectRecordsAsync();
for(let record of mainTableRecords.records) {
let lookupValue = record.getCellValue("ID Customer");
for(let rangeRecord of lookupRangeRecords.records) {
if(rangeRecord.getCellValue("ID Customer") === lookupValue) {
let myName = rangeRecord.getCellValue("myName");
let user;
if(rangeRecord.getCellValue("User") != null) {
user = rangeRecord.getCellValue("User").id;
} else {
user = rangeRecord.getCellValue("User");
}
await mainTable.updateRecordAsync(record, {
"My name (other)": myName,
"User (other)": { "id": user },
});
}
}
}
Thanks,
Dav
