Cannot update the value of a multiple select field

I’m trying to script some record creation right now and it involves populating a multi-select field, but for some reason I’m unable to make this updating work no matter how I try. I know that a multiple select field needs to be updated with array values only, so this is what I’ve attempted:

var book_arr = [];
book_arr.push(book_num);
await new_table.updateRecordAsync(newRecord, {'Book Number':book_arr});

where book_num is a single value that I know is already a valid option for the multi-select. I also tried to pass it directly when creating the record as just

'Book Number':[book_num],

but no dice there either. I don’t see anything in the API documentation about updating the value of a multi-select field, only updating the options, so not sure where to turn here.

The API docs will show you under “Cell write format” how each field needs to recieve data. Airtable Scripting

The format for multiple select fields is an array of objects where each object contains the key/value pair of either the name or ID of the select choice. Assuming book_num is the text visible for the intended select choice, your array should look like this:

[{name: book_num}]
1 Like

Thanks for the input; turns out the book_num variable was being created as a string array rather than a string, so it required a parse and then push! Glad to have it solved.

This topic was solved and automatically closed 3 days after the last reply. New replies are no longer allowed.