Help

Cannot update the value of a multiple select field

Topic Labels: Scripting extentions
Solved
Jump to Solution
3437 3
cancel
Showing results for 
Search instead for 
Did you mean: 
Alyssa_Buchthal
8 - Airtable Astronomer
8 - Airtable Astronomer

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.

1 Solution

Accepted Solutions

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.

See Solution in Thread

3 Replies 3

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}]

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.

Matteo_Cossu3
6 - Interface Innovator
6 - Interface Innovator

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}]}