
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 06, 2023 02:28 PM

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 06, 2023 02:53 PM - edited Jun 06, 2023 02:56 PM
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
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 06, 2023 10:11 PM - edited Jun 06, 2023 10:11 PM
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}]
})
};

- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Jun 07, 2023 04:06 AM
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
