how to add choice options from another table dynamically on an ui page

hemanth_alapati
Mega Contributor

how to add options to a choice list/drop down dynamically from table in an ui page.

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

Hi Hemanth,

can you share your code here? also from which table and what field you want to fetch

you can use html select tag to create drop down based on the choice values

sample script here

for example I have used incident table and state column

<g:evaluate var="jvar_gr" object="true">

var gr = new GlideRecord('sys_choice');

gr.addQuery('element', 'state');

gr.addQuery('name', 'incident');

gr.quey();

gr;

</g:evaluate>

<select>

<j:while test="${jvar_gr.next()}">

<option value="${jvar_gr.value}">${jvar_gr.label}</option>

</j:while>

</select>

Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur

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

View solution in original post

5 REPLIES 5

Can you please post this as new question as this thread is quite older?

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