Related List default ordering

twenger26
Giga Contributor

Hi,

I am trying to get a related list (change_task) which is shown on the Change form to default sort by the field Order instead of Number by default.  I impersonated users which don't have any user preferences set, but for some reason it still sorts by Number instead of Order.   

I found the documentation below for Jakarta (which we are on) and from that it appears the Order should take precedence.   

The only issue I can think of is because the change_task table inherits from the task table, and the order field is on the task table instead of the change_task table that's causing the issue.   Any help would be much appreciated:

 

find_real_file.png

 

Also, I added a dictionary override on the Task table (change_task) with attribute isOrder=true, and it still doesn't sort properly.

 

find_real_file.png

1 ACCEPTED SOLUTION

MG Casey
Mega Sage

Also - if you want users to be able to override your sort order on just a normal related list (not based on Relationship record setup), you can create a user preference marked as "system":

 

find_real_file.png

 

The 2 preference names:

tablename.db.order.direction - value of "ASC" or "DESC"
tablename.db.order - value of desired field name to sort by

 

View solution in original post

5 REPLIES 5

twenger26
Giga Contributor

Also, I added a dictionary override on the Task table to change_task with attribute isOrder=true, and it still doesn't override. 

MG Casey
Mega Sage

If you want a related list to always be sorted in a certain way, it's better to create a Relationship and use that as the related list instead.

 

https://docs.servicenow.com/bundle/jakarta-platform-user-interface/page/administer/form-administration/task/t_CreateDefinedRelatedLists.html

 

Example of one my Relationships I've set up with a default sort:

find_real_file.png

I stumbled upon this solution after looking at and trying a lot of other things! It matched my requirements exactly, many thanks! 🙂

MG Casey
Mega Sage

Also - if you want users to be able to override your sort order on just a normal related list (not based on Relationship record setup), you can create a user preference marked as "system":

 

find_real_file.png

 

The 2 preference names:

tablename.db.order.direction - value of "ASC" or "DESC"
tablename.db.order - value of desired field name to sort by