ORDERBY is not working for Lookup select box in service portal
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-18-2018 09:34 PM
Hi Team,
I have one catalog item where in I am using one lookup select box variable. I want the choices to be sorted out based upon on the department field in the reference table I am using for lookup.
I have used below code in advance qualifier of this lookup variable
javascript:getRequestType()
and this is refering to script include
script include
function getRequestType()
{
var query = 'u_parent='+current.variables.Application_Component+'^u_active=true'+'^u_service_request=cc00174a4f252b404c73cf5d0210c7e3'+'^ORDERBYu_department';
return query;
}
This is working perfectly fine in internal servicenow. However, not working on service portal. Please help me to fix this issue.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-20-2018 06:49 AM
Hi
You don't necessarily need to add the " '+' " in between each section as you are not adding variable values each time.
As it department a custom field, make sure it has the correct spelling.
try
var query = 'u_parent=' + current.variables.Application_Component + '^u_active=true^u_service_request=cc00174a4f252b404c73cf5d0210c7e3^ORDERBYu_department';

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2018 01:58 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-21-2018 03:47 AM
Hi Stewe,
I have below attributes for this variable
ref_qual_elements=Application_Component,ref_ac_order_by=u_department
but no luck

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-22-2018 01:09 AM
Hi!
This is a direct copy of a functioning Variable Attribute
ref_auto_completer=AJAXTableCompleter,ref_ac_columns=;user_name;name;company,ref_ac_columns_search=true,ref_ac_order_by=name
I havent had time to play around with this but can it be that you have to show the column that you are sorting by.