Jelly Scripting to pull Unique PO numbers on the alm_hardware table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-27-2025 02:42 PM
Hello everyone,
I am relatively new to Jelly scripting and working on a custom interactive filter for a dashboard we use for hardware asset management.
I'm trying to make a drop-down where you can select multiple POs from a dropdown that displays Unique Values only.
I am so very green so I put together this following Jelly based on some AI and some ServiceNow articles:
<j:jelly xmlns:j="jelly:core" xmlns:fmt="jelly:fmt" xmlns:xml="jelly:xml" xmlns:g="glide">
<g:log msg="Starting PO Number filter creation"/>
<g:query table="alm_hardware" var="hardware">
<g:select distinct="true" field="po_number"/>
</g:query>
<g:if test="${hardware.hasNext()}">
<g:log msg="PO Numbers found"/>
<select id="po_number_filter">
<option value="">-- Select PO Number --</option>
<g:while test="${hardware.next()}">
<option value="${hardware.po_number}">${hardware.po_number}</option>
</g:while>
</select>
</g:if>
<g:else>
<g:log msg="No PO Numbers found"/>
</g:else>
</j:jelly>
However the content block shows as being empty.
Can someone please point me in the direction of were I'm going wrong? I feel like it's pulling an empty table but I tried "PO number" "po_number" and "po number" and none of them turn up data.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-31-2025 09:26 AM
Thank you for marking my response as helpful.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader