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.

Dinamyc content block as interctive filter fiel business department

Reporting Team
Tera Contributor

Hi Community,

 

I need a dinamyc content block that works as intercative filter using cmdb_ci_business_app.u_business_department.

I defined an script, butt it doens't work 😞

 

The script code is:

<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
&lt;script&gt;
var my_dashboardMessageHandler = new DashboardMessageHandler("my_unique_id");

function publishFilter () {
var filter_message = {};
filter_message.id = "my_unique_id";
filter_message.table = "cmdb_ci_business_app";
var value = gel('cfBusiness Department').value;
filter_message.filter = "u_business_departmentLIKE" + value;
SNC.canvas.interactiveFilters.setDefaultValue({
id: filter_message.id,
filters: [filter_message]
}, false);
my_dashboardMessageHandler.publishFilter(filter_message.table, filter_message.filter);
}

function clearFilter() {
var filter_message = {};
filter_message.id = "my_unique_id";
filter_message.table = "cmdb_ci_business_app";
filter_message.filter = "";
gel('cfBusiness Department').value = '';
SNC.canvas.interactiveFilters.setDefaultValue({
id: filter_message.id,
filters: [filter_message]
}, false);
my_dashboardMessageHandler.removeFilter();
}
&lt;/script&gt;

Short Description:
<input id="cfBusiness Department" type="input" value="" /><br/>
<input id="removeCustomFilter" type="button" value="Clear" onclick="clearFilter();" />
<input id="addCustomFilter" type="button" value="Search" onclick="publishFilter();" />

</j:jelly>

 

But it doesn't work. I use a similar dinamyc content block to filter incident.short_description and it works! I cna't find my error with thisnew content block.

 

Any idea to help me?

Thanks in advance!!!

MEF

 

1 REPLY 1

Reporting Team
Tera Contributor

Hello again,

I continue working with dinamyc content block and I have realized that the problem is that I use a database view as a table.

If I use this dinamyc content block with a report that uses a table , it's working! but if I use a database view , the dinamic content block, Any idea to help us?

 

Thanks in advance,

MEF