Dec 01, 2024 07:45 AM
Hi,
I want to update the choices a singleSelect field has without adding a new record.
I tried this approach, but that yields the following error
TypeError: Cannot add property 2, object is not extensible
Here is the relevant code (MtypeName gets its value from a singleLineText field)
let MtypeName = Mtype.getCellValueAsString("Meeting Type")
let Types = MeetingsTable.getField("Meeting Type")
Types.options.choices.push({name: MtypeName})
Solved! Go to Solution.
Dec 01, 2024 10:52 PM
You can do this via the Scripting Extension: https://airtable.com/developers/scripting/api/field#update-options-async
const table = base.getTable("Tasks");
const selectField = table.getField("Priority");
await selectField.updateOptionsAsync({
choices: [...field.options.choices, {name: "Urgent"}],
});
If you want this to be part of an automation you'd need to do it via the API like you said though, and you'd need to auth
Dec 01, 2024 10:52 PM
You can do this via the Scripting Extension: https://airtable.com/developers/scripting/api/field#update-options-async
const table = base.getTable("Tasks");
const selectField = table.getField("Priority");
await selectField.updateOptionsAsync({
choices: [...field.options.choices, {name: "Urgent"}],
});
If you want this to be part of an automation you'd need to do it via the API like you said though, and you'd need to auth