Custom interactive filters using dynamic content block not filtering report for tasks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2024 10:03 AM
Hello
We have a dashboard with a report which shows all tickets. We want a interactive filter as a checkbox of each task type so we can select and only see 'Incidents' or 'Requests' on the report. We tried using the normal interactive filter options, but could only find the options to filter the list down using a dropdown, which we don't want. When we tried the checkbox, we had to exclude 1000's of options, which just isn't feasible.
I found another post about creating it as a content block > Dynamic content instead.
I have created it, but it doesn't work on the report.. No matter what option I select, the report shows all tickets still. Title of report is 'Platform Support'
Script is:
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<g:evaluate var="jvar_tasktypes" object="true" jelly="true">
var tables = 'sc_req_item,incident,u_callback';
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>
<div id='filter_task_type'>
<j:forEach var="jvar_tasktype" items="${jvar_tasktypes}">
<label>
<input type="checkbox" value="${jvar_tasktype[0]}" onchange="filterTaskType()" />
${jvar_tasktype[1]}
</label><br/>
</j:forEach>
</div>
<script>
var dbh = new DashboardMessageHandler("filter_tasktype", function () {
SNC.canvas.interactiveFilters.setDefaultValue({
id: "filter_tasktype",
filters: [{ table: "task", filter: "" }]
}, false);
});
function filterTaskType(){
var selected = [];
$j('#filter_task_type input[type=checkbox]:checked').each(function() {
selected.push($j(this).val());
});
if (selected.length > 0)
dbh.publishFilter('task','sys_class_nameIN' + selected.join(','));
else
dbh.removeFilter();
}
filterTaskType();
</script>
</j:jelly>
I need a way to either get the interactive filter to be a checkbox and only show 3 ticket types
OR
Fix the above dynamic content block so it connects to the report and filters it.
Thanks
Abbie
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-19-2024 10:19 AM - edited 12-19-2024 10:25 AM
Update:
I have got this working. The original dashboard page had another standard interactive filters for filtering the assignment groups. As soon as I took this away, the filters then worked.
So my new question .... Can you not use interactive filters and Content Block Filters at the same time?
How can I get a filter for assignment group and filter for task type (filtered so only incident/request/callback task types show in the checkbox) on the same dashboard/report.