I’m trying to overwrite a Field’s options with a list provided dynamically from data that is imported. I have successfully updated the options to use the previous values in addition to the new set of values (similar to the example the documentation provides).
However, the use case for my app is to start from scratch: delete all existing records (and ideally field options), and import a fresh set of data with field options that match the new data. The documentation points to UpdateFieldOptionsOpts as a way to do this, but after trying a few combinations, I have not gotten it to work.
Any thoughts from the community on what I might be doing wrong? Here is some sample code to demonstrate the issue:
let choices = {
choices: e
{"name": "Option 1"},
{"name": "Option 2"},
]
}
if (field.hasPermissionToUpdateOptions(choices)) {
await field.updateOptionsAsync(choices, {"enableSelectFieldChoiceDeletion": true});
}