How to configure the sorting order of Data Reference selection options in combo box?

When implementing Case or Data reference fields, we select a datapage list to populate selectable values. The order in which the selectable items are displayed can be defined when you use a table view, but not with the other options (combo box, cards etc) and only when the field based on which the order needs to be done (Ascending/Descending) are part of the displayed field.

Example:

This can be an issue for some of our use cases, especially for combo boxes / cards and when (for tables) we dont want to display the field on which the sorting takes place. The sorting order that is applied by default seems to be random and can not be influenced.

Now what can we do if we run into this issue? Luckily there is a way out of this:

  1. Ensure that the datapage list based on which the selectable values are loaded is already pre-sorting the values in the correct order. For most of the use cases, this means you sort on report definition level.
  2. Disable the option “Allow querying any column (Pega connection only)“ in your datapage.

Now your values are sorted exactly the way they need to be sorted! Also you could then use a sorting order integer field in case this is relevant for your data type (often part of reference data definitions).

Result: