azure-devopstfs-workitemazure-devops-services

How to keep pick list sorted in original order on Azure DevOps Services Hosted XML process?


How to keep Pick List Sorted as original order - not alphabetically.

Code of Pick List

      <FIELD name="Release Date" refname="ReleaseDate" type="String" reportable="dimension">
        <ALLOWEXISTINGVALUE />
        <ALLOWEDVALUES expanditems="true">
          <LISTITEM value="May 2023 Rel" />
          <LISTITEM value="Jun 2023 Rel" />
          <LISTITEM value="Jul 2023 Rel" />
          <LISTITEM value="Aug 2023 Rel" />
          <LISTITEM value="Sep 2023 Rel" />
          <LISTITEM value="Oct 2023 Rel" />
          <LISTITEM value="Nov 2023 Rel" />
          <LISTITEM value="Dec 2023 Rel" />
          <LISTITEM value="Jan 2024 Rel" />
          <LISTITEM value="Feb 2024 Rel" />
          <LISTITEM value="Mar 2024 Rel" />
          <LISTITEM value="Apr 2024 Rel" />
          <LISTITEM value="May 2024 Rel" />
        </ALLOWEDVALUES>
      </FIELD> 

Image - List on Display - sorted alphabetically

enter image description here

looked through documentation and couldn't find an option to keep sorting https://learn.microsoft.com/en-us/azure/devops/reference/add-modify-field?view=azure-devops-2022#picklist


Solution

  • Per the documentation:

    Elements within the list always appear in alphanumeric order, regardless of how you enter them in the XML definition file. The Reference Name, or refname, is the programmatic name for the field. All other rules should refer to the refname. For more information, see Naming restrictions and conventions.

    Thus, the only way to do what you want is to add some sort of sortable identifier at the front of the field name. i.e. 001 - May 2023, 002 - June 2023, etc.