Skip to main content

Hey Everyone, Can anyone spot where I'm going wrong here?!

I am trying to add multiple values to a multiple-choice field:

const YesVotes = ["Adam", "Bob", "Charlie"];



const YesArray = [];



for (var i = 0; i < YesVotes.length; i++) {

YesArray.push('{name: ' + YesVotes[i] + '}');

}



console.log(YesArray);

So the console log is giving me what I think I want:

["{name: Adam}", "{name: Bob}", "{name: Charlie}"]

But the function 

output.set('YES Votes', YesArray);

Is not making the change to the YES Votes column of my table.

Hi @ssdata  - Here's documentation on multiple selects https://airtable.com/developers/scripting/api/cell_values#multiple-selects

This works to update options within the field (column)

let table = base.getTable("YOUR TABLE NAME");



const multipleSelectField = table.getField('YES Votes');

await multipleSelectField.updateOptionsAsync({

choices: [

...multipleSelectField.options.choices,

{name: 'My new choice'},

],

});






Hi,
the command output.set(varname, value) does not change data in table and setup for field. It just pass value as step output, which you can use in further steps.

 

Reply