How to show customized ordered records in List view
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2025 10:26 PM - edited 06-29-2025 11:03 PM
Hi everyone,
I have a custom table with the following fields: Category(Choice field with options: Application, General, Network, Software, Password), Order(String), and Inactive(Checkbox).
I'm trying to achieve the following:
- Display all records where Category= General at the top.
- After that, show records from other Category.
- Within each Category, the Order field should be sorted alphabetically (A to Z) and Inactive is false.
Has anyone implemented a similar sorting logic or have suggestions on how to achieve this in a list view or through scripting?
Thanks in advance!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2025 03:04 AM
Hi @Avee90
Can you explain a bit more in details?
So as per initial image, you want to get general at top, and remaining catagory below right?
Now what is this Sequence No1 and Sequence No2 field?
Or is it Category and Sub-Category setup
Like General and its sub-cat is: ABC, XYZ, DEF
so you want general at top and ABC, XYZ and DEF also based on order?
and same way with other category as well?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2025 03:27 AM
The table having 4 fields -1) Catgoery(Choice field: General, Network, Application, Software and Password), 2) Sequence No1(String: User can give 1-5 values) 3) Sequence No2(String: User can give 1-5 values) and 4) Inactive field(Active/Inactive)
So, There will be 150 records which have diff categories with Sequence No1 and No2(1-5).
I need to show General records at the top with those records should sort with Sequence No1 and Sequence No2
Ex: 1st record: Category - General, Sequence No 1 - '1', Sequence No 2 - '1'
2nd record: Category - General, Sequence No 1 - '1', Sequence No 2 - '2'
2nd record: Category - General, Sequence No 1 - '2', Sequence No 2 - '1'
.
.
.
Category - Network, Sequence No 1 - '2', Sequence No 2 - '1
Below are the records with values
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-30-2025 06:12 AM - edited 06-30-2025 06:24 AM
@Avee90 it should show as category field choice itself?
Also You need to do this by creating script include and call it in dictionary record or client script
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2025 11:30 PM
at dictionary level you can add the sorting
is that a choice field with those many choices?
check this
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-29-2025 11:26 PM - edited 06-29-2025 11:26 PM
Hi @Avee90,
Do you have a list of values that will be static or the list is going to be updated in time?
If the first option, you can do the order manually but if new and new records will be created, existing updated (e.g. renamed) and/or deleted, then it will be too messy.
You might need to create a new field that would be hidden and in that field you can help the ordering, but it is already overkill just simply thinking about it.
And what about connect the two field into one?
"Category - Value":
"General - Network"
"General - Server"
"Password - Access"
"Application - SNUtils"
Ooooooor last idea - set the field as "Name-Value pair" type maybe (not tested, just an idea)
https://www.servicenow.com/docs/bundle/washingtondc-platform-administration/page/administer/field-ad...
Let me know how it goes..
/* If my response wasn’t a total disaster ↙️ ⭐ drop a Kudos or Accept as Solution ✅ ↘️ Cheers! */