Interested in a ServiceNow event built for developers? Registration for now[dev]26 is officially open!

Jelly Scripting to pull Unique PO numbers on the alm_hardware table

Rachel Reviczky
Tera Contributor

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&nbsp;number" and none of them turn up data. 

5 REPLIES 5

@Rachel Reviczky 

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.

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