Reference qualifier descending order

arai keigo
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

Samaksh Wani
Giga Sage
Giga Sage

Hello @arai keigo 

 

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
Mega Sage

Hi @arai keigo 

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.

If my answer has helped with your question, please mark my answer as accepted solution and give a thumb up.
Regards,Sushant Malsure

Hi @sushantmalsure 

Lookup variable type select box cannot be sorted that way