Try putting item.workerID in an array of objects like
"Worker": [{id: item.workerID}]
More info: https://airtable.com/developers/scripting/api/cell_values#multiple-record-links
I think when updating a linked record field via a script, you have to specify a list of the records you'd like to link to, with each one's record id specified.
Try reformatting your code like this:
const outputTable = base.getTable('Work Weeks');
for (item of result) {
await outputTable.createRecordAsync({
"Week Number": item.week,
"Total Hours": item.value,
"Worker": [{id: item.workerID}]
})
};
I think when updating a linked record field via a script, you have to specify a list of the records you'd like to link to, with each one's record id specified.
Try reformatting your code like this:
const outputTable = base.getTable('Work Weeks');
for (item of result) {
await outputTable.createRecordAsync({
"Week Number": item.week,
"Total Hours": item.value,
"Worker": [{id: item.workerID}]
})
};
Hi @autumn,
Your suggestion is exactly what I had already recommended.
@Matt_Lister, if my suggestion helps at all here please feel free to mark it as the solution.
I appreciate it!
-Stephen
Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.