Alphabetically order custom connect app single/multiple select values

We have several connect app descriptor issue fields ( that are single or multiple select fields.
We populate them with the API with additional values over time, eg added a,b,c,d,e initially then over time added bb,cc,aa,bbb,dd and then again added items like ee,aaa. - this then results in a dropdown showing a,b,c,d,e,bb,cc,aa,bbb,dd,ee,aaa and not a,aa,aaa,b,bb,bbb,c,cc,d,dd,e,ee.
How can we auto-alphabeticize the dropdown for the single/multi select fields with each update via the API or other automated fashion?
Thank in advance

Hello @YatishMadhav

This question has been asked quite a few times. The REST API endpoints for managing the contents of issue fields do not have any ‘auto sorting’ capability. New values are just appended to the end of the set of existing values.

The only way to achieve the outcome you describe is to totally erase the set of values and re-build it in the sequence you need.

  1. Get all the values of the select field and store them in an array in your code
  2. Add the new value(s) to the array, then sort the array alphabetically
  3. Erase the set of values of the select field
  4. Upload the new set of values in the order stored in the sorted array

Thanks for the reply here as well @sunnyape

Yeah, I have see it in a few places and have seen this but not exactly what we want to do.

Yeah, that was a thought we did have initially BUT this would assign new ids to each of the options which may break other automation :frowning: A catch 22.

First prize would be to have the ability to sort the field options by ID or by value … Do you know of a ticket I can upvote or watch for this? Or should I also raise a support/feature request for it?

Thank you

The endpoints for moving items in a custom list are fairly new and I’ve not had a reason to use them yet, but I suppose it’s reasonable to assume you can use it to move a new value to a particular place to make it in be in the correct alphabetic order. This at least would preserve the existing values and their IDs.

You’d still need to lookup all the current values in the list first, then do an offline add of your new value, then sort the set alphabetically to know what location the new value would need to be moved to after you added it… but boy, that’s a real overhead of work and processing just to keep all the IDs of the existing values intact just because some other automation has that requirement.

Doing some things via the REST API are just cumbersome, and there’s no shortcut.

Search through the existing Jira Cloud feature requests to see if anyone else has suggested such a ‘self sorting’ capability when new values are added to a list field, but your chances are slim.

Good luck.

:frowning: oh! I actually meant to post this link

Does not look like we can order options in fields created be apps! :frowning:

To your suggestion for the workflow, yes, very exhaustive. Would be nice to just be able to have it sorted when needed or as default :slight_smile:

Thanks again @sunnyape