Jan 12, 2022 03:12 PM
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.
Solved! Go to Solution.
Jan 13, 2022 02:42 PM
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.
Jan 12, 2022 05:40 PM
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}]
Jan 13, 2022 02:42 PM
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.
Feb 09, 2023 10:19 AM
is there a way when creating a record, to pass a string array of names or id's to a multiple select field?
i.e. instead of createRecAsync fields: {'MyMultipleSelectField', [{name: string1}, {name: string2}, {name: string3}]}
createRecAsync fields: {'MyMultipleSelectField', [{name: string1, string2, string3}]}