---
sourceDocument: Xanadu ServiceNow AI Platform Administration
sourceDocumentLink: https://servicenow-prod.fluidtopics.net/r/xanadu/platform-administration

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu ServiceNow AI Platform Administration

ft:clusterId :

    - platadm

bundleId :

    - platadm

workflow :

    - Platform


---

# Controlling the sort sequence used to display lists

# Controlling the sort sequence used to display lists {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 2 minutes to read

All lists have a default sort sequence based on the type of fields present in the
list.

When a user displays a list for the first time, it is sorted by one of the following items.

* The ORDERBY arguments found the URL. (See the following section on sort order control.)
* The \<table\>.db.order and \<table\>.db.order.direction user preferences.
* The isOrder dictionary attribute.
* The Order field if one is present in the table.
* The Number field if one is present in the table.
* The Name field if one is present in the table.
* The field specified as the display field for the table.

Note:  
The task table is an exception to the preceding sequence. Task and tables extended from task use the Number field when no URL arguments or user preferences are found.

## Setting default order with user preferences {#c_ControlTheListSortSequence__section_nvm_byn_ndb}

The \<table\>.db.order and
\<table\>.db.order.direction user preferences determine the field and
sort direction seen by the user. A default sort can be created by creating user preference
records with no value in the User field and checking the
System check box. This preference is applied to any users who do not
have their own preference.

## Setting the default sort order in the system dictionary

An administrator can set the sort order of records displayed for a table in the system
dictionary when there is no other sort specified. This is done by adding an attribute called
isOrder with a value of true to the dictionary
entry of the desired field. This sort is the sort order presented to all users initially. Once a
user sorts a list, that user preference is saved, and the list is always sorted for that user
based on the previous sorting preference.  
Note:  
isOrder can define which field is used for list sorting, but cannot control the sort direction.
**Related concepts**   

* [System dictionary](https://servicenow-prod.fluidtopics.net/4a2v7eTS8qFMt~3PiE0b7w "View a list of all tables in columns in your instance from the system dictionary.")
* [Altering tables and fields using dictionary attributes](https://servicenow-prod.fluidtopics.net/W62P_HvztvVqWYI5duwoKQ "Dictionary attributes alter the behavior of the table or field that the dictionary record describes. Administrators can add or modify dictionary attributes.")  
**Related topics**   

* [User preferences](https://www.servicenow.com/docs/access?context=c_UserPreferences&version=xanadu&pubname=xanadu-platform-user-interface&ft:locale=en-US)

## Sort order control {#ariaid-title2}

For any list, if the user has clicked a column header to sort by that column, then that
action is remembered. The next time that list is displayed, the same field is used to order the
list.
This remembered sort field can be overridden by adding a <var class="keyword varname">sysparm_order</var>
specification to the definition of the module. For example, if each time
News is displayed, you want the new items listed in order of
importance, then the News module can be updated accordingly.  
Figure 1. Set module sort order to the Importance field value ![Module arguments to set the sort order based on the Importance field]() The actual order (ascending or descending) can be specified by adding a
<var class="keyword varname">sysparm_order_direction</var> specification. Here are two examples of sorting
a list by the sys_created_on field, one ascending and one
descending:  

    &sysparm_order=sys_created_on &sysparm_order_direction=desc
    &sysparm_order=sys_created_on &sysparm_order_direction=asc

### Sort by multiple fields

To sort a list by multiple fields, remove everything from the filter field and place it in
the arguments field. For example, if the filter specifies \[Active\] \[is\] \[true\] and you want to sort by category and subcategory, remove the condition
and put the following in the module arguments:  

    active=true^ORDERBYcategory^ORDERBYsubcategory

This argument first orders by the category and then orders by the subcategory. If you want
any field to be a descending sort, then change <var class="keyword varname">ORDERBY</var> to be
<var class="keyword varname">ORDERBYDESC</var>.

