Help

Auto-add options in single select through airtable script

Topic Labels: Automations
2457 1
cancel
Showing results for 
Search instead for 
Did you mean: 
Ankit_Srivasta1
4 - Data Explorer
4 - Data Explorer

Use case : “I want to automatically add options in single select. These options need to get updated automatically when a new ‘unique’ value appears in a column of different table. The value of option added automatically in single select, should be the new unique value that appears in the column of different table.”

Problem : I haven’t been able to get a solution for this. I have tried to solve this through airtable scripting. I have repeatedly got a issue in the following code for simple testing ( I may add values of different column in the script later) :

// query for all the records in a table
let table_uploader = base.getTable("Data Uploader");          
const selectField = table_uploader.getField("Location-select-script");

await selectField.updateOptionsAsync({ choices: [
        ...selectField.options.choices,
        {name: 'London'},
    ],})

I could print through console.log and see that “Location-select-script” is a single select option, but when I was typing code to update ‘single select options’ and use “await selectField.updateOptionsAsync” , a red line is appear under updateOptionsAsync . And it’s not recognizing it as a inbuilt method for selectField.

Please confirm, is there issue in code to be resolved. Or are there any other solutions I can see into, to get this functionality working.

1 Reply 1
Alyssa_Buchthal
8 - Airtable Astronomer
8 - Airtable Astronomer

Are you attempting this via the scripting app, or as part of an automation? Unfortunately, updating single select options is only supported through the app, not the automations feature. Hopefully they’re working to improve this functionality, because I would definitely have use for it in my team’s automations!
image