Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Sorting on Incident table list view based on priority for all user ?

KamalpreetS
Tera Contributor

when any user visit incident list view then the table should sorted based on 'priority' field,
how can we do this. I tried with user preference but its not work.
I want to sort the list view for all user on Incident table based on Priority.

1 ACCEPTED SOLUTION

Chaitanya ILCR
Mega Patron

Hi @KamalpreetS 

you can create a query BR 

ChaitanyaILCR_0-1747100693806.png

(function executeRule(current, previous /*null when async*/) {


	current.addEncodedQuery('ORDERBYpriority');  //from high to low
	// current.addEncodedQuery('ORDERBYDESCpriority'); form low to high

})(current, previous);

 

ChaitanyaILCR_1-1747100801826.png

for low to high comment first line and use 2nd 

 

 

if it just one module(application module) you can update the module URL parameters (sysparm_query) and append them with ^ORDERBYpriority

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

View solution in original post

3 REPLIES 3

Sean Addington
Tera Expert

Hi @KamalpreetS,

 

I see there's a few ways noted here, but one way I've tried this so far is by setting the sort order on the module under the "Link Types > Arguments" field, and should allow you to specify the sort order. Hope this helps.

 

https://www.servicenow.com/docs/bundle/yokohama-platform-administration/page/administer/list-adminis...

Chaitanya ILCR
Mega Patron

Hi @KamalpreetS 

you can create a query BR 

ChaitanyaILCR_0-1747100693806.png

(function executeRule(current, previous /*null when async*/) {


	current.addEncodedQuery('ORDERBYpriority');  //from high to low
	// current.addEncodedQuery('ORDERBYDESCpriority'); form low to high

})(current, previous);

 

ChaitanyaILCR_1-1747100801826.png

for low to high comment first line and use 2nd 

 

 

if it just one module(application module) you can update the module URL parameters (sysparm_query) and append them with ^ORDERBYpriority

 

 

Please mark my answer as helpful/correct if it resolves your query.

Regards,
Chaitanya

 

KamalpreetS
Tera Contributor

@Chaitanya ILCR Thanks, it works for me 🙂