Custom interactive filters are unreliable

dosualdo1
Tera Expert

Hello, everyone!

 

I was trying to use a custom interactive filter I found online (https://www.servicenow.com/community/platform-analytics-forum/interactive-filter-quot-between-dates-...), but it seemed to work only part of the time. I tried to debug it, but couldn't find anything wrong, and what's weird is that it DID work, but just a small part of the time.

So I made a simple custom filter on my PDI, a filter for the incident table, to get records opened after an specific date (I chose this date because of the demo data there). And so, by removing the complexity of the previous filter, I'm inclined to think that there's something wrong with custom filters themselves.

 

The details of my test are the following:

 

I created the filter by creating a widget and a macro, as seen below.

dosualdo1_2-1673030978837.png

dosualdo1_1-1673030657488.png

The main line of code for the filter is:

 

 

DMH.publishFilter("incident","opened_at>javascript:gs.dateGenerate('2022-02-24','13:30:00')");

 

 

This is basically what runs everytime I run the filter. It is a method of a DashboardMessageHandler object, that gets as parameters the table that it will be applied at, and the encoded query to filter.

 

Then I created a dashboard, and in it I put the test filter widget, then the list widget, then checked "follow interactive filter" on the list widget. Then, when I clicked the filter button, it didn't filter the page.

dosualdo1_3-1673031066421.png

I tried refreshing the page, but the button didn't do anything. But then I tried removing the report from the dashboard and including it back. After configuring it to follow the filters and clicking the filter button, it worked!

dosualdo1_4-1673031258665.png

And then, after refreshing the page again, it stoped working!

 

Has anyone else encountered this problem?

3 REPLIES 3

dosualdo1
Tera Expert

Bump

ankitbadola
Giga Expert
Add this in business rule - Get Date Filter Option
 
  answer.add('185_November@javascript:new GlideDateTime("' + new test().getMonthStart() + '")@javascript:new GlideDateTime("' + new test().getMonthEnd() + '")', gs.getMessage('November'));
 
Script include : 

getMonthStart: function() {
        gs.info('BeginYear');
        var str = '';
        str += gs.dateGenerate('2022-01-01''00:00:00');
        return str;
    },

    getMonthEnd: function() {
        gs.info('EndYear');
        var str1 = '';
        str1 += gs.dateGenerate('2023-05-31''23:59:59');
        return str1;
    },
 
You will see the magic . Thanks

and what about this query conditon how to run it using business rule "calendar_stc<172800000" Resolved time is less than 3 days