Sorting custom user field dropdown items

AI-generated summary

jenmck discusses the challenge of maintaining a long, required custom user field dropdown that must remain alphabetized. Currently, new items are appended to the bottom, requiring manual reordering via up-arrows, which is tedious for large lists. The user inquired about easier sorting methods, the feasibility of an automatic “display alphabetically” option or theme component, whether replacing the list via a cron job preserves existing user selections, and the possibility of adding an API endpoint for this functionality.

In response, chapoi directed the user to an existing topic from three years ago regarding re-ordering dropdown options, noting there was no new information available. Chapoi recommended voting on that older thread to help prioritize the feature request, as grouping similar requests often aids in prioritization.

I have a custom user field with a very long list of dropdown options. For reasons, users are not allowed to enter their own value in this field, and this field must exist as a dropdown, and it is a required field for all users.

From time to time, I need to add or remove items to the list. Because it’s such a long list, I have it alphabetized.

The pain here is that new items are added to the bottom, and i need to manually click the up arrow for each new item in order to re-alphabetize the list.

I did a search, and got this AI result, which is incorrect - there is no Admin > Customize > User Fields page.

I checked for an API endpoint at docs.discourse.org and didn’t see anything related to custom user fields.

This topic: Dynamically update available user field values during a profile fill in does outline a method for updating the list using a cron job (though it’s not quite my use case, it is similar enough). I’m very leery of doing it this way, though.

I have searched for other topics related to this; I know I had asked about it about 3 years ago, but didn’t want to necro that topic.

My questions:

  • is there an easier way to sort dropdown lists than clicking the arrow manually for each item
  • would it seem like something feasible to add a display alphabetically option or have it manually display alphabetically using a theme component, or is this more complicated to accomplish than it seems?
  • if the only option is to go the route of creating a cron job for it, if the dropdown list is completely replaced, would current users retain the selection they’ve already made, if it is listed exactly the same in the replaced list?
  • what would be the chances that this could be added as an API endpoint?

Sincerely,
someone with a lot of clicking to do

There isn’t any new information so I’d recommend to add your vote to that one (it has zero votes atm and the voting feature is often how we prioritze work). It’s totally fine to bring it back alive! And often better to keep all asks grouped instead of scattered across multiple support topics.