Sort order based on multiple parameters

palmen
Tera Guru

Is it possible to sort a list based on more then one parameter?

What our users want is a possibility to sort a list based on task type (the list is on the Task table) and then each task type should be sorted by end date so you always have the task closest to end date at top.

Is there some other sort order you can use than ascending/descending? Can you configure it in some way to show Task type in this order:

Incident

Change

SRQ

Problem

Knowledge Submissions

1 ACCEPTED SOLUTION

Brad Tilton
ServiceNow Employee
ServiceNow Employee

When you do "is dynamic" that sysid that is shown is actually the sysid of the filter rather than your user record, so you should be ok there. getMyAssignments() will also work and may actually be better as it takes delegates into account.



The short answer to your custom search order question is no, but you could add some sort of custom field to the task table that gets set by the task type (Incident = 1, Change = 2, etc.) and sort on that field.


View solution in original post

4 REPLIES 4

Brad Tilton
ServiceNow Employee
ServiceNow Employee

You should be able to do that pretty easily with the Add Sort button in the list filter.



e0f303cef4.png


Thanks for the input, didn't know you could click on the "sort-button" more then once.



They want this list of records as a module and from what I understand I'll need to use "URL (from arguments)" to be able to use sort as well. The issue here is when you do this by argument and set "Assigned to is (dynamic) Me" it'll put my sys_id in the URL so it will only work for me. I changed it to the "oldschool" way of doing it with "javascript:getMyAssignments()". Are there any drawbacks here to use a javascript in the URL? It doesn't sound like the best thing to do but I'm no security expert.



Still my second question from original post remain? Can I configure the sort order to a specific order I want?


Brad Tilton
ServiceNow Employee
ServiceNow Employee

When you do "is dynamic" that sysid that is shown is actually the sysid of the filter rather than your user record, so you should be ok there. getMyAssignments() will also work and may actually be better as it takes delegates into account.



The short answer to your custom search order question is no, but you could add some sort of custom field to the task table that gets set by the task type (Incident = 1, Change = 2, etc.) and sort on that field.


Valentina3
Kilo Explorer

Hi all,

I have a similar problem: I need to sort incidents on 2 parameters, in particular, "opened" and "priority", but SN sorts by the first one only.

In the attachment, the result set after applying filter.

Can you help me?

Thanks in advance.