- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2023 03:24 AM
Hi All,
I have added a List report on the Dashboard with source as catalog task table. I want to apply the interactive filter to this dashboard using Content Block widget.
On this widget, I have added 2 date_time fields to pick the date/time with one button to call the below function
When i am passing the two static date/time values (between) to the publish filter, dashboard return the result correctly. But i would like to use the date value entered on the form in 2 fields and pass to this function.
I have tried to use below but it is not working and returns no data.
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2023 12:54 AM
Hi,
Try this code and confirm if this works fine
<?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("my_unique_id");
function publishFilter () {
var filter_message = {};
filter_message.id = "my_unique_id";
filter_message.table = "sc_task";
var startdatetime = document.getElementById('DateTime1').value;
var enddatetime = document.getElementById('DateTime2').value;
var startdate = startdatetime.split(" ")[0];
var startdate_format = startdate.split("-")[2] + "-" + startdate.split("-")[0] + "-" + startdate.split("-")[1]
var starttime = startdatetime.split(" ")[1];
var enddate = enddatetime.split(" ")[0];
var enddate_format = enddate.split("-")[2] + "-" + enddate.split("-")[0] + "-" + enddate.split("-")[1]
var endtime = enddatetime.split(" ")[1];
<!-- Add your own filter query logic here -->
filter_message.filter = "opened_atBETWEENjavascript:gs.dateGenerate('" + startdate_format + "','" + starttime + "')@javascript:gs.dateGenerate('" + enddate_format + "','" + endtime + "')";
SNC.canvas.interactiveFilters.setDefaultValue({
id: filter_message.id,
filters: [filter_message]
}, false);
my_dashboardMessageHandler.publishFilter(filter_message.table, filter_message.filter);
}
Palani

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2023 08:44 AM
Hi,
Can you try the below filter:
filter_message.filter = "opened_atBETWEENjavascript:gs.dateGenerate('2023-05-01','00:00:00')@javascript:gs.dateGenerate('2023-09-01','23:59:59')";
Palani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-17-2023 09:01 AM
Thanks @palanikumar
This works perfectly fine if we pass the static date/time values in the filter qualification. But i have two date/time fields on the form as below and it should run dynamically
When fields are selected, i hit the search button and it should pass those 2 values in the filter

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-18-2023 12:54 AM
Hi,
Try this code and confirm if this works fine
<?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("my_unique_id");
function publishFilter () {
var filter_message = {};
filter_message.id = "my_unique_id";
filter_message.table = "sc_task";
var startdatetime = document.getElementById('DateTime1').value;
var enddatetime = document.getElementById('DateTime2').value;
var startdate = startdatetime.split(" ")[0];
var startdate_format = startdate.split("-")[2] + "-" + startdate.split("-")[0] + "-" + startdate.split("-")[1]
var starttime = startdatetime.split(" ")[1];
var enddate = enddatetime.split(" ")[0];
var enddate_format = enddate.split("-")[2] + "-" + enddate.split("-")[0] + "-" + enddate.split("-")[1]
var endtime = enddatetime.split(" ")[1];
<!-- Add your own filter query logic here -->
filter_message.filter = "opened_atBETWEENjavascript:gs.dateGenerate('" + startdate_format + "','" + starttime + "')@javascript:gs.dateGenerate('" + enddate_format + "','" + endtime + "')";
SNC.canvas.interactiveFilters.setDefaultValue({
id: filter_message.id,
filters: [filter_message]
}, false);
my_dashboardMessageHandler.publishFilter(filter_message.table, filter_message.filter);
}
Palani
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-01-2024 08:45 AM
@palanikumarI am using the same script but its not working for me could you help.