ORDERBY is not working for Lookup select box in service portal

rmunjal
Mega Explorer

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.

11 REPLIES 11

Dan Tolgyesi1
Tera Expert

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';

Stewe Lundin
Mega Guru

Check out the Variable attributes on the Variabel.

ref_ac_order_by

find_real_file.png

Hi Stewe,

I have below attributes for this variable

ref_qual_elements=Application_Component,ref_ac_order_by=u_department

but no luck

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.