- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2019 05:08 AM
how to add options to a choice list/drop down dynamically from table in an ui page.
Solved! Go to Solution.
- Labels:
-
Personal Developer Instance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2019 05:27 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2019 05:27 AM
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
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-25-2019 09:49 PM
Hi Ankur,
thanks for the response. i wanted to fetch from a custom table that is created in our instance. i wanted to set the choice values based on the value selected in a particular field.
i will try the soultion given by you and let you know.
thanks,
hemanth

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-25-2021 12:41 AM
There is a typo where says "gr.quey();" is gr.query(); instead.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-14-2021 10:50 PM