How to update a multiple select field without overwriting?

I have a multiple select field I am attempting to update within an automation, but I can’t seem to add an option to it without overwriting. Pared down, this is essentially what my code looks like right now:

Val = record.getCellValue("The Cell")
if(conditions met) {
    await table.updateRecordAsync(record.id, {"The Cell": [Val, {name: "NewVal"}]});
 }

And this isn’t working, as it says it can’t recognize this input type. I’ve also tried using getCellValueAsString and then passing that as another option, but that didn’t work either. Right now the code is working but is overwriting the cell value when it does, so I want to add this functionality where it doesn’t overwrite. Any help appreciated!

Hi @Alyssa_Buchthal,
Here is a snippet from the documentation that shows how to add an item and retain the existing items.

const selectField = table.getField('My select field');
await selectField.updateOptionsAsync({
    choices: [
        ...selectField.options.choices,
        {name: 'My new choice'},
    ],
});

I’m not trying to update the options, I’m trying to update the actual content of the field. Nothing for it in the documentation, but I did end up solving the issue by needing to reference the index and .name of the original field values, then I could pass them in as arguments. All fixed now!

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