Order by 2 fields in URL

kungfuu72
Giga Expert

I came across this article and have used this functionality in the past to get a list to be ordered in a default way which I specify:

https://wiki.servicenow.com/index.php?title=Controlling_the_Sort_Sequence_Used_to_Display_Lists#gsc....

The example gives you a way to order by 2 fields using the encoded query, but how would I do this for the first example where I want to append 2 order by specifications in the URL arguments ?

Example of one order by with one order direction:

&sysparm_order=sys_created_on&sysparm_order_direction=desc

* Note: This will probably also mean specifying 2 order directions. This may or may not be possible... anyone have an idea?

3 REPLIES 3

edwin_munoz
Mega Guru

Hello Daniel,



Please refer to section number 3 in this link:



Controlling the Sort Sequence Used to Display Lists - ServiceNow Wiki



You can do something like this in your URL:



sysparm_query=^ORDERBYfield1ORDERBYfield2



User orderbydesc when sorting by descending order.



Thanks


Okay, I will test that out and get back to this.


Section 3 says to put that in the Arguments field - and there doesn't seem to be an arguments field in my instance.   I've looked under configure form layout as well and cannot find one.   Can you clarify what is meant?     Thanks in advance.