How do I sort a list view by State sequence number?

Mark_Bailey
Mega Guru

I had to create a new state on my change control.

The new state is called CAB Approval and in the process flow comes right after Owner approval.

sort.png

So the new Cab approval is sequences 6 even though the value is 12. I do not want to change values. There are way too many scripts wrote on the current values. 1-11, so adding 12 was harmless. I think!     Everything works well except one thing.


When I go under change and click on all changes, (Grouped) by state, CAB Approval shows at the bottom of this list. I think it is safe to say the group order is using the value as the way to sort the group. I need to sort the group on the Sequence instead, so CAB approval shows in the correct order.


Capture.JPG

From reading the wiki I need to add to the sort to the URL argument shown below but I am not clear what to add. Can you help?

change_request_list.do?sysparm_query=GROUPBYstate&sysparm_view=




1 ACCEPTED SOLUTION

coryseering
ServiceNow Employee
ServiceNow Employee

Hi Mark,



Typically you'd change the Sort by adding an ORDERYBY clause to the query, like below:



change_request_list.do?sysparm_query=GROUPBYstate^ORDERBYsomefield&sysparm_view=



However, in this case it won't solve your problem. The "Sequence" field is not selectable this way- you cannot order by a Choice field's sequence.



If you know the specific query that you need to display the data for, you might consider writing a custom UI Page, and bordering the final output via a script so you can control how they are displayed.



UI Pages - ServiceNow Wiki


View solution in original post

2 REPLIES 2

coryseering
ServiceNow Employee
ServiceNow Employee

Hi Mark,



Typically you'd change the Sort by adding an ORDERYBY clause to the query, like below:



change_request_list.do?sysparm_query=GROUPBYstate^ORDERBYsomefield&sysparm_view=



However, in this case it won't solve your problem. The "Sequence" field is not selectable this way- you cannot order by a Choice field's sequence.



If you know the specific query that you need to display the data for, you might consider writing a custom UI Page, and bordering the final output via a script so you can control how they are displayed.



UI Pages - ServiceNow Wiki


OK thank you.