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.

How to sort out results from the 'Lookup using list' icon by a certain field in a particular order

matthew_hughes
Kilo Sage

When I click on the 'Lookup using list' icon next to the 'Accountable tech organisation':

matthew_hughes_0-1732722946423.png

The following results appear:

matthew_hughes_1-1732723007355.png

 

However, what I'm wanting to do is sort the results in the following order:

By Department Type and starting  with Departments where Department Type is 'Platform'

 

Does anyone know what I need to do to sort the results?

 

3 REPLIES 3

JenniferRah
Mega Sage
Mega Sage

I'm guessing that "Accountable tech organisation" is a Reference variable pointing to the cmn_department table. Is that right? And the second screen shot is the list of departments shown? And Department Type is a custom field? If so, you should be able to accomplish this by setting up your variable like this: 

 

JenniferRah_0-1732726385506.png

 

If you don't want it filtered to just those department types, then I don't know of a way to have it sort by that but start at Platform. Maybe if that field was a number field and the display value was Platform, but the value was 0 or 1, it would sort those at the top, but I'm not sure if that's an option.

Hi @JenniferRah 

 

I've filtered the results as specified to show departments with a Department type of Platform or Lab:

 

matthew_hughes_0-1732786655101.png


However, one thing I did notice is that I go to the list of departments itself, it's being sorted by the 'Updated by' date

 

matthew_hughes_1-1732786729480.png

 

Do you know what I need to do to override it so that it sorts the department records by the 'Department Type' field?

That usually is a user setting that is remembered from session to session. I think the default for a view is to sort by the first column.