Needing help defining publishMultipleFilter
Options
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-05-2024 08:15 AM
When I'm testing out this Customer Interactive Filter I keep getting an error message within the developer tool of my chrome browner. I thought I had defined publishMultipleFilter but I guess not. Please let me know of any other solutions I can test out.
Error Message:
$pa_dashboard.do?sys…dgetSideContent:528 Uncaught ReferenceError: publishMultipleFilter is not defined at HTMLInputElement.onchange ($pa_dashboard.do?sys…tSideContent:528:24)
<?xml version="1.0" encoding="utf-8" ?>
Error Message:
$pa_dashboard.do?sys…dgetSideContent:528 Uncaught ReferenceError: publishMultipleFilter is not defined at HTMLInputElement.onchange ($pa_dashboard.do?sys…tSideContent:528:24)
<?xml version="1.0" encoding="utf-8" ?>
<j:jelly trim="false" xmlns:j="jelly:core" xmlns:g="glide" xmlns:j2="null" xmlns:g2="null">
<script>
var my_dashboardMessageHandler = new DashboardMessageHandler("sys_id");
var start = ""
var end = ""
function publishMultipleFilter() {
console.log(date,version,start,end)
if(version=="start"){
start=date
} else {end=date}
<!-- Mutliple filters can be passed as an array -->
var finalFilter = [{"table":"incident","filter":"opened_atONFortnight@javascript:gs.daysAgoStart(440)@javascript:gs.daysAgoEnd(0)"}, {"table":"problem","filter":"opened_atONFortnight@javascript:gs.daysAgoStart(440)@javascript:gs.daysAgoEnd(0)"}];
<!-- call setDefaultValue first -->
SNC.canvas.interactiveFilters.setDefaultValue({
my_dashboardMessageHandler._unique_id,
filters: finalFilter,
}, false);
<!-- then call Publishmessage to publish filters-->
my_dashboardMessageHandler.publishMessage(finalFilter);
}
function processDateRange(startDate, endDate) {
// Base case: if startDate is greater than endDate, stop recursion
if (endDate >= startDate) {
// Log the current date in a readable format
console.log(startDate.toISOString().split('T')[0]);
// Create a new date object to avoid mutating startDate directly
const nextDate = new Date(startDate);
nextDate.setDate(startDate.getDate() + 1);
// Recursive call with the next date
processDateRange(nextDate, endDate);
}
}
// Call the function with the desired date range
processDateRange(new Date('2023-01-01').toISOString(), new Date('').toISOString());
function clearFilter() {
SNC.canvas.interactiveFilters.removeDefaultValue(my_dashboardMessageHandler._unique_id, false);
my_dashboardMessageHandler.removeFilter();
}
</script>
<input type="date" id="start" value="" onChange="publishMultipleFilter(this.value,'start')"/>
<input type="date" id="end" onChange="publishMultipleFilter(this.value,'end');"/>
</j:jelly>
I've already reference most of the documetation, here are some of the links I've reviewed:
https://www.servicenow.com/docs/bundle/xanadu-now-intelligence/page/use/dashboards/reference/r_Custo...
https://www.servicenow.com/docs/bundle/utah-now-intelligence/page/use/dashboards/concept/dynamic-js-...
https://www.servicenow.com/community/platform-analytics-forum/interactive-filter-quot-between-dates-...
I've already reference most of the documetation, here are some of the links I've reviewed:
https://www.servicenow.com/docs/bundle/xanadu-now-intelligence/page/use/dashboards/reference/r_Custo...
https://www.servicenow.com/docs/bundle/utah-now-intelligence/page/use/dashboards/concept/dynamic-js-...
https://www.servicenow.com/community/platform-analytics-forum/interactive-filter-quot-between-dates-...
0 REPLIES 0