TypeError: record.getCellValue(...) is null
Scripting to MultiSelect Linked.. only works when at least one item is in the field
Best answer by Alexey_Gusev
@TheTimeSavingCo Thank you. I also came upon another issue... In the updateRecord, if that ID is already in the field, it throws an error that the record already exists. I added this chunk. If someone has a better solution I am all ears.
Hi,
insert function somewhere before loop
const addlnk=(arr,lnk)=>[...new Set(arr? [...arr.map(a=>a.id),lnk]:[lnk])].map(x=>({id:x}))
use:
await table.updateRecordAsync(record, {
'People_Link': addlnk(record.getCellValue('People_Link'),linkID)
})
It takes all IDs from existing linked records (if they exist) + new, puts into Set (to remove possible duplicate), spread back to array of IDs and map it to array of objects {id: X}
p/s/ I don't know how do you looping through list, but if you have list of records and possibly their IDs, why add single ID to each record, while you can update just one record (in other table, the 'owner' of linkID)
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.








