Skip to page contentSkip to chat
ServiceNow support
    • Community
      Ask questions, give advice, and connect with fellow ServiceNow professionals.
      Developer
      Build, test, and deploy applications
      Documentation
      Find detailed information about ServiceNow products, apps, features, and releases.
      Impact
      Accelerate ROI and amplify your expertise.
      Learning
      Build skills with instructor-led and online training.
      Partner
      Grow your business with promotions, news, and marketing tools
      ServiceNow
      Learn about ServiceNow products & solutions.
      Store
      Download certified apps and integrations that complement ServiceNow.
      Support
      Manage your instances, access self-help, and get technical support.
Resetting the default list view to include sort order - Support and Troubleshooting
  • >
  • Knowledge Base
  • >
  • Support and Troubleshooting (Knowledge Base)
  • >
  • Resetting the default list view to include sort order
KB0748683

Resetting the default list view to include sort order


3646 Views Last updated : Apr 7, 2024 public Copy Permalink
KB Summary by Now Assist

Issue

Description

When "Reset to column defaults" is selected to reset a personalized list view to the default layout, the sort column and direction are not included. This can be confusing for users if they had sorted on a column that is not part of the default layout. The list would appear to not be sorted by any column.

The "Reset to column defaults" action calls the script include UIPage. Line 19 initiates the reset process which consists of several calls to other script includes and back end classes.

Unfortunately, this logic does not affect the sys_user_preference records related to the sort column and direction. The preferences are <table_name>.db.order and <table_name>.db.order.direction.

 

Procedure

*** Customization Disclaimer ***

The following procedure describes an unsupported customization. Please utilize with care and always test first in sub-prod.

 

The UIPage script include can be modified to set the sort preferences when it resets to the default list layout. This sample code starts at line 19:

Before

else
  v.reset(this.getParameter('sysparm_table'));

After

else {
  v.reset(this.getParameter('sysparm_table'));
     
  var tbl = this.getParameter('sysparm_table');
  
  // If we're resetting the Incident table
  if ( tbl == 'incident' ) {

    // Set the sort column user preferences to the default values
    gs.getUser().setPreference( tbl + '.db.order', 'number');
    gs.getUser().setPreference( tbl + '.db.order.direction', 'DESC');
  }
}

Call a separate script include

The above example sets the sort column to number when the incident table is reset to the default layout. To apply this functionality to multiple tables, a more manageable approach would be to move this logic into its own script include which can then be called from this script include:

else {
  v.reset(this.getParameter('sysparm_table'));
  
  var sortReset = new tableSortReset();
  sortReset.checkTable( this.getParameter('sysparm_table'));
}

Applicable Versions

Tested in Madrid

 


The world works with ServiceNow.

Sign in for more! There's more content available only to authenticated users Sign in for more!
Did this KB article help you?
Did this KB article help you?

How would you rate your Now Support digital experience?

*

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

Very unsatisfied

Unsatisfied

Neutral

Satisfied

Very satisfied

What can we improve? Please select all that apply.

What are we doing well? Please select all that apply.

Tell us more

*

Do you expect a response from this feedback?

  • Terms and conditions
  • Privacy statement
  • GDPR
  • Cookie policy
  • © 2025 ServiceNow. All rights reserved.