Update interactive filter from URL params

Justin Pakula
Mega Guru

Hello,

I have a business requirement to update a dashboard dynamically from a URL using an interactive filter. The dashboard contains 3 reports and an interactive filter. I would like to create a module link in the filter navigator that will redirect to that dashboard with my parameters that will auto populate the interactive filter that already exists on the page. 

I have a module link redirecting to the homepage with my parameters. I have a dynamic content block which accepts the URL parameters and will filter the reports, however, the existing interactive filter will not update to the correct filtered value. For example, I have an interactive filter for active records. The defaulted value in the interactive filter widget loaded is "true" but my parameter from the URL will say "active=false". The page will load and filter the reports from the dynamic content block I have written and update the records, but the interactive filter will still say "active=true". I am not sure how to update the interactive filter to match my URL parameters.

Here is very simplified example of the dynamic content block. 

<?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 encQuery = "active=true";
        publishToFilter(encQuery);

        function publishToFilter (encQuery) {
            var taskDashboardHandler = new DashboardMessageHandler('task_filter_handler');
            taskDashboardHandler.publishFilter('task', encQuery);
            console.log("Publishing Filter: " + encQuery);
        }
	</script>
</j:jelly>

 

Any help is much appreciated!

Thank you,

Justin

4 REPLIES 4

salmezy
Giga Contributor

Hello Justin,

Any luck figuring this out.

I have the same requirement.

 

Thank you,

Salman Ahmed

Community Alums
Not applicable

Hi @Justin Pakula & @salmezy ,

Anyone of you able to achieve this requirement.? If yes, kindly help on the same.

Regards,

Sirraj

CMDB Whisperer
Mega Sage
Mega Sage

This doesn't seem to be documented as a URL parameter and since $dashboards.do is private, my assumption is that this is not currently possible, but I too would be very interested in doing this.  Browsing the idea portal I see a lot of enhancements related to interactive filters but only one of them has been implemented, and none of them refer to the URL parameters.  So I think the chances of getting this done any time soon are very low.


The opinions expressed here are the opinions of the author, and are not endorsed by ServiceNow or any other employer, company, or entity.

CMDB Whisperer
Mega Sage
Mega Sage

Worth noting here that if you rebuild your dashboard in UI Builder, you can pass whatever parameters you want and create a much more dynamic experience!


The opinions expressed here are the opinions of the author, and are not endorsed by ServiceNow or any other employer, company, or entity.