- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎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})
If this is only possible using the Rest API, I suppose I cannot use this without providing the authentication details, right ?
Solved! Go to Solution.
Accepted Solutions
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎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
- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎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
