Welcome to Community Week 2025! Join us to learn, connect, and be recognized as we celebrate the spirit of Community and the power of AI. Get the details  

How to reuse choice lists on variables?

peterraeves
Mega Guru

I created a choice list on a variable on a record producer and now I want to reuse that choice list on another variable. How can I do that?

I tried to do 'Lookup select box' and point to the question_choice table. This gives the correct list, but the order is not correct. So how should I be able to order them like the original as well?

It seems that the ORDERBY statement does not work in reference qualifiers either...

1 ACCEPTED SOLUTION

peterraeves
Mega Guru

This is what I did in the end and it works like a charm.



Image 1.png


View solution in original post

8 REPLIES 8

ananthagowraram
Mega Expert

Hi Peter,



Try writing some client side script gliding towards question_choice table.Through script order by works fine




Regards


Anantha Gowraram


Hi Anantha,



Please note orderby does not work in client side codes.


Hi Peter,



You can write a script include unchecking the client box,   and gliderecord question_choice table with right queries and then you can use OrderBy(); function . Once you get results in the   while(next()) loop, simply push it into a array.



Finally return the array.


Can you try that please?


Hi Sharique,



Orderby works in client side when we use gliderecord



@peter here is sample code



function onChange(control, oldValue, newValue, isLoading) {  


  if (isLoading || newValue == '') {  


      return;  


  }  


 


  var gr = new GlideRecord("incident");  


  gr.addQuery("assigned_to", newValue);  


  gr.orderByDesc("sys_created_on");  


  //gr.orderBy("sys_created_on");  


  gr.query();  


  if (gr.next()) {  


    g_form.setValue("parent", gr.sys_id);  


  }  


}  



Regards


Anantha Gowraram