Make reference varible list in alphabetical order

ebaileyybs
Tera Expert

Hi,

How do I make a reference variable list show in alphabetical order by default?

I'm assuming this is a variable attribute but i don;t know what attribute to use.

Thanks in advance!

5 REPLIES 5

Michael Fry1
Kilo Patron

ref_ac_order_by: is the variable attribute to use. Section 19 wiki: Variable Types - ServiceNow Wiki


HI,



I added the following to the variable attributes field but it hasn't made any difference to the order.



ref_ac_order_by=name



Is this right?



Thanks for your help



Emma


I faced the same issue. I overcame by creating a query business rule on the looked up table.


But if you do the same you will have to be careful that the query br runs only when the request comes from reference field's lookup and no where else.


-Anurag

Hi Anurag,

 

Thanks for the insights on this, I created a query business rule to sort the records order based on the creation date.

This is the query BR:

(function executeRule(current, previous /*null when async*/ ) {

// Add your code here
current.orderByDesc('sys_created_on');

})(current, previous);

Question: How would you add the trigger condition for this BR, if the trigger is coming from one of the catalog items reference fields.

BR's only run on specific tables right?

Thanks,

Naren