How to use Custom Interactive Filter?

Today, I recognize that a custom interactive filter can be mighty. Here is why.

I wanted to create a dashboard containing 2 reports. The first report should show incidents grouped by Category, and the second should show incidents grouped by CI. So far, all is well & easy, and no need for a custom interactive filter.

I also wanted to enable my end-users to filter on a short description; in other words, I would like them to be able to interactively use the Short Description CONTAINS filter on my dashboard.

The standard interactive couldn’t allow me to do that. Hence I created a custom interactive filter. The filter should take end-user input and then search on Short description.

below is the Dynamic Content block, which I used as a Custom Interactive filter

<?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("incident_dashboard");
  
    function searchbyShortDesc (str) {

        var filter_message = {};
        filter_message.id = "incident_dashboard";
        filter_message.table = "incident";
    
    <!--     Add your own filter query logic here -->

        filter_message.filter = "short_descriptionLIKE" + str;
        SNC.canvas.interactiveFilters.setDefaultValue({
                id: filter_message.id,
                filters: [filter_message]
            }, false);
        my_dashboardMessageHandler.publishFilter(filter_message.table, filter_message.filter);
    }
    

 </script>   
 
<input id='interactive' type='text' value='' onChange='searchbyShortDesc(this.value);'/>

</j:jelly>

3 Comments

  1. Hi Ahmed,
    I need script for interactive filter such a way that I need to see all parent’s from sys_user_group table in a dropdown .Can you help me?

    Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s