I have a webhook that is meant to create new records on a table. Some records have new values for a singleSelect type field. I tried to create a function (code bellow) to provision new options but it fails with “Error: Cannot update field config from scripting automation”.
Without the field my await table.updateRecordAsync
also fails if I pass text to this singleSelect field.
Is there any way to provision new values on a option field, to mimic the behavior of the UX where if you paste a new value it is provisioned automatically? if not, a feature request would be the passing of an option to the value of updateRecordAsync such like “create non existing values” or something.
async function updateIfNeeded(table,field,choiceName)
{
const selectField = table.getField(field);
if (!selectField.options.choices.find((choice) => choice.name == choiceName))
{
await selectField.updateOptionsAsync({
choices: [
...selectField.options.choices,
{name: choiceName},
],
});
}
}
Thanks