Interactive Filter setup to show specific choices for task type

alexbones
Tera Expert

Is there a way to setup interactive filters to only show specific task types? I only need to show a list of about 5 different task types. I have set up the interactive filter as a choice list, but I shows all task types in the drop down. I see there is an exclusions list, but that is adding a lot of exclusions to narrow down the scope to 5 types.

Thanks!

Alex

15 REPLIES 15

tstocking
Tera Guru

Hi Alex,

 

Did you ever find a way to accomplish this? I was looking to shrink the list myself and also activate some items by default. The only way I could see doing this is creating dummy sys_choice values for the missing task types. I don't want to necessarily go down this path as I'm not sure what else this could impact.

Arnoud Kooi
ServiceNow Employee

yoi need a custom interactive filter. Please have a look at this video:

the code for the content block:

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<!-- By Arnoud Kooi Check https://youtu.be/I2eDVi9CAWI -->
<g:evaluate var="jvar_tasktypes" object="true" jelly="true">
var tables = 'incident,problem,change_request';
var obj=[];
var gr= new GlideRecord('sys_db_object');
  gr.addEncodedQuery('super_classISNOTEMPTY^ORname=task^nameIN' + tables);
  gr.addOrderBy('name');
  gr.query();
  while(gr.next()){
    obj.push([gr.getValue('name'),gr.getValue('label')]);
  }
  obj;
</g:evaluate>
 
    <select id='filter_task_type' class='select2-search' onchange='filterTaskType()'>
        <option value="">All</option>
        <j:forEach var="jvar_tasktype" items="${jvar_tasktypes}">
            <option value="${jvar_tasktype[0]}">${jvar_tasktype[1]}</option>       
        </j:forEach>
    </select>  
 
    <script>
     var dbh = new DashboardMessageHandler("filter_tasktype");
     function filterTaskType(){
        var taskType = $j('#filter_task_type').val();
        if (taskType)
            dbh.publishFilter('task','sys_class_name=' + taskType);
        else
            dbh.removeFilter();
     }
     filterTaskType();
</script>
 
</j:jelly>

I’m having an issue with this code I’m in Tokyo and it will work until you change tabs then it stops working until you uncheck and recheck the widget to interactive with filters. 

Hi @Keith Hnasko I am also having issues using this same Script in Tokyo - experiencing exactly the same issue that you mention. Just wondering have you managed to get this working or found a solution so this works in Tokyo release, by any chance?

Many thanks kind sir.