Hi,
This behavior is expected in Mendix and not a bug.
Mendix does not use the order of enum values defined in Studio Pro when sorting. Internally, enum attributes are stored as string keys, and any sorting (in retrieves, Data Grid 2, or lists) is performed alphabetically on those stored values.
Because of this:
You are trying to achieve a business-defined order, for example:
PendingOEassignment should appear firstPendingOMReview should appear firstThis cannot be achieved using default enum sorting.
Introduce an explicit sort field and use that for ordering.
Add a new attribute to your entity:
SortOrder (Integer)Assign a numeric value for each enum:
This mapping can be done:
In your retrieve or Data Grid:
SortOrder ASC (for ascending requirement)SortOrder DESC (for reverse order)Use a calculated attribute:
These approaches do not affect sorting behavior in Mendix.
Mendix sorts enum attributes based on their internal string values, not the order defined in the enumeration. To achieve a custom ordering, you must implement an explicit sorting mechanism such as a numeric SortOrder attribute and use that attribute in your sorting logic.
Hi Harsh,
Enum sorting in Mendix is:
What you are trying to achieve is unfortunately not how Mendix handles enumeration sorting.
In Mendix, sorting an Enumeration attribute in a retrieve (ascending or descending) is not based on the order of the enum values as you arrange them in Studio Pro. So even if you move PendingOEAssignment to the top of the enum list, it will not appear first when sorting ascending.
The reason is that Mendix typically sorts enums based on their stored/technical value rather than their visual order in the model. That’s why your changes in the enum order are not reflected in the result.
If you need a specific business order (for example, always showing PendingOEAssignment first and PendingOMReviewlast), the recommended approach is to not rely on enum sorting.
Instead, add a separate Integer attribute like SortOrder to your entity and assign values based on your desired order. Then sort your retrieve using this attribute.
If you only need this in a specific case, you could also retrieve the list and apply custom sorting in a microflow or Java action, but using a dedicated sort attribute is the cleanest and most maintainable solution.
If this resolves your issue, please mark the answer as accepted.