populate select box from glide record

techies
Kilo Expert

Hello all,

        So I am creating a UI page that requires a select box to become populated with values that are stored inside a custom table. The custom table

        has a column that contains a 'choices field' with several different choices. I am wondering if there is a way to get an array of these values into the

        jelly script and use it in the select box. An example would be lovely too.

Thank you for any help.

1 ACCEPTED SOLUTION

Here you go



<g:evaluate var="jvar_test" object="true" jelly="true">


var obj=[];


var gr= new GlideRecord('u_sales_order_ui');


  gr.query();


  while(gr.next()){


obj.push(gr.u_subcategory.toString());


  }


  obj;


</g:evaluate>


<select>


  <j:forEach var="jvar_item" items="${jvar_test}">


          <option value="${jvar_item}"> ${jvar_item} </option>


  </j:forEach>


</select>


View solution in original post

19 REPLIES 19

Not sure if I understod your question.


In this line     gr.addQuery('nameSTARTSWITHincident^element=category'); you are calling the column in the table called category? I'm wondering how I create the same column in my custom table.


Thanks


So you already have a custom table and you want to create choices based on the values from your custom table right?


Yes in the custom table I have made a choices column with different choices. I want to create a select box based on those choices.


What is the field name and table name