catalog item

kuntasaiviv
Kilo Contributor

 while creating a list type of field for a  catalog items i want the records to be populated when brand is "xyz" as well as  order by sequence and it should be reflected in serviceportal view.

i have tried in ref qualifier with the below 
element =xyz^ORDERBYsequence
and 
element =xyz^ref_ac_order_by=sequence

i have also tried with by calling script include as well with below code.
var arr = [];
       var gr = new GlideRecord('sys_choice');
       gr.addQuery('element', 'bon_voyage_items_max_2_items');
       gr.orderBy('sequence');  // ordering applied here
       gr.query();

       while (gr.next()) {
           arr.push(gr.getUniqueValue()); // or gr.label if you want label only
       }

       return arr; var arr = [];
       var gr = new GlideRecord('sys_choice');
       gr.addQuery('element', 'xyz');
       gr.orderBy('sequence');  // ordering applied here
       gr.query();

       while (gr.next()) {
           arr.push(gr.getUniqueValue()); // or gr.label if you want label only
       }

var l = arr.tostring();

       return "sys_idIN"+l;
still the records are not populating in the sequence  order.

can anyone help me with this issue ASAP.

2 REPLIES 2

Bhimashankar H
Mega Sage

Hi @kuntasaiviv ,

 

Try this in attribute

Set Reference qualifier to brand=xyz, and add attributes:

ref_auto_completer=AJAXTableCompleter,ref_ac_order_by=sequence

 

Refer this post:

Lookup select box reference qual - sort by sequence 

Controlling the sort sequence used to display lists 

ServiceNow Not Honoring Sort By Sequence Number 

and

Reference field autocomplete - sort the list in descending order - Article 

 

 

Thanks,
Bhimashankar H

 

-------------------------------------------------------------------------------------------------
If my response points you in the right directions, please consider marking it as 'Helpful' & 'Correct'. Thanks!

Ankur Bawiskar
Tera Patron
Tera Patron

@kuntasaiviv 

share your variable config screenshot

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader