Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Custom Interactive Filter not showing values from choice table

BijoyDeb
Tera Contributor

Hi All,

 

I am creating a dynamic content block in my scoped application to show values in dropdown from choice table.

But somehow, dropdown is showing no values.

When I created it in global scope, it was showing values in dropdown, but filter was not getting applied to report on dashboard.

 

Can someone please look into following code

 

 

<?xml version="1.0" encoding="utf-8" ?>


<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">


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


           var obj=[];


           var gr= new GlideRecord('sys_choice');


           gr.addQuery('name=x_rnod_hexa_proc_office^element=region^language=en');


           gr.query();


           while(gr.next()){


     obj.push([gr.getValue('value'),gr.getValue('label')]);

           }


           obj;


     </g:evaluate>


     <script>


           var dbh = new DashboardMessageHandler("filter_usertype");


           function filterUserType(){


     var userType = $j('#filter_user_type').val();


     if (userType)


   dbh.publishFilter('x_rnod_hexa_proc_procurement_request','office.region=' + userType);


     else


   dbh.removeFilter();


           }


     </script>


     <select id='filter_user_type' class='select2-search' onchange='filterUserType()'>


           <option value="">All</option>


           <j:forEach var="jvar_usertype" items="${jvar_usertypes}">


                 <option value="${jvar_usertype[0]}">${jvar_usertype[1]}</option>


           </j:forEach>


     </select>


</j:jelly>


0 REPLIES 0