Remove an option from choice field when it has been selected 4 times

Dear community,

I have a field which gives a multiple choice of dates.

I would like to add an automation where when one of the options get selected for 4 times, it will be removed from the multiple choice list.

For example in the screenshot above, if 17/1 has been selected 4 times, remove or hide it so no one can select that anymore.
The idea behind it is that this is a registration form, and I offer 4 slots for each of those dates and when one of the dates has been selected 4 times the date slot should automatically be made unavailable.

To make that happen I could think there needs to be a few things

  1. A new field that counts the number of times the date has been selected
  2. Compare the field in 1) and trigger and action to hide the date slot but I can’t figure out how to hide the option from the multiple choice.

Hope I have explained well, thanks all!

To the best of my knowledge removing an option of a single/multiple select field can only be accomplished via scripting. As is the case with scripting in Airtable, the script can be in the form of a Scripting app to be triggered manually or a step in an automation, the latter of which seems to fit the bill here.

The script to do so looks something like the below. Take note of the enableSelectFieldChoiceDeletion option which allows for previously available options that don’t exist in the choices array to be removed:

let table = base.getTable('Table Name');
let selectField = table.getField('Field Name');
await selectField.updateOptionsAsync(
    { choices: [...selectField.options.choices.filter(c => c.name != 'Option 1')] },
    { enableSelectFieldChoiceDeletion: true }
);

The caveat here, however, is that removing an option from a select field doesn’t just remove it as a selection for new records. It also removes it as an option from existing records, so any record that had that option as selected previously would now have an empty value in the field.

One way to work around that is to create a separate select field with the same values as the original, & copy the value to that select field prior to removing the option from the user-facing field. That way you’ll be able to keep the selected value for all records, even if they have since been removed due to being selected x number of times.

Hope this helps!

@Mr_Hope Note that you can do what you want automatically with a linked record field, but not with a multi-select field. If you want/need to stick with a multi-select field, you’ll need to manually craft your own workaround like the ideas that @Jonathan_Lutz outlined above.