Reference qualifier descending order

araik
Tera Contributor

I'm using a "look up selection box" type variable in a catalog item.

I cannot find a way to sort the choices in ascending order.

Is there a way to sort the choices?

I have included the syntax "ORDERBY XXX" in the reference modifier, but it does not sort them.

3 REPLIES 3

Not applicable

Hello @araik 

 

var inc = '';
var gr_incident = new GlideRecord('incident');
gr_incident.addEncodedQuery('caller_id='+caller);
gr_incident.orderByDesc('number');
gr_incident.query();


while(gr_incident.next()) {
inc += (',' + gr_incident.sys_id);

}

 

Plz Mark my Solution as Accept and Give me thumbs up, if you find it Helpful.

 

Regards,

Samaksh

 

sushantmalsure
Mega Sage

Hi @araik 

Try following:

in variable attributes: ref_ac_order_by=<orderFieldName>

and

in reference qualifier add=  javascript&colon;'ORDERBY<orderFieldName>'

note: replace <orderFieldName> with correct field value from the referenced table on which sort needs to be added.

Hi @sushantmalsure 

Lookup variable type select box cannot be sorted that way