---
sourceDocument: Xanadu Platform Analytics
sourceDocumentLink: https://www.servicenow.com/docs/r/xanadu/now-intelligence

 Release :

    - xanadu

ft:locale :

    - en-US

ft:publication_title :

    - Xanadu Platform Analytics

ft:clusterId :

    - par

bundleId :

    - par

workflow :

    - Platform


---

# DashboardMessageHandler

# DashboardMessageHandler {#ariaid-title1}

* Release version: Xanadu
* 
* Updated August 1, 2024
* 
* ![](https://www.servicenow.com/docs/portal-asset/ico-clock) 1 minute to read

Provides methods to define custom filtering logic for interactive filters.

For more information about interactive filters, see [reporting](https://www.servicenow.com/docs/H158SFNCQMrpw6nQvkvdZg "ServiceNow Reporting enables you to create and distribute reports that show the current state of instance data, such as the number of open incidents of each priority. Reporting functionality is available by default for all tables, except for system tables.") and [interactive filters](https://www.servicenow.com/docs/7GZYaas6evXTxVgAntpK0Q "Interactive Filters allow you to filter all reports on a dashboard dynamically, without modifying the original reports.").

## DashboardMessageHandler - DashboardMessageHandler(String id) {#ariaid-title2}

Instantiate a DashboardMessageHandler object with a given unique ID.
{#r_DashboardMessageHandler-DashboardMessageHandler_String__table_mdj_3yc_lr__entry__3}

| Name | Type | Description |
|-|-|-|
| Id | String | A unique ID for the filter. This ID allows report widgets to track which filter applied each filter. The ID does not need to be unique across all dashboards, but each dashboard cannot have multiple filters with the same ID. |
[Table 1. Parameters]

{#r_DashboardMessageHandler-DashboardMessageHandler_String__table_mdj_3yc_lr}  

    var my_dashboardMessageHandler = new DashboardMessageHandler("my_unique_id");

## DashboardMessageHandler - publishFilter(String table, String encodedQuery) {#ariaid-title3}

Each DashboardMessageHandler object can publish a single filter.
Publishing a new filter from the same object overwrites the original filter. Use multiple
DashboardMessageHandler objects to publish multiple filters.
{#r_DashboardMessageHandler-publishFilter_String_String__table_bh3_nyc_lr__entry__3}

| Name | Type | Description |
|-|-|-|
| table | String | The table to filter, such as task. |
| encodedQuery | String | An encoded query that specifies the filter to publish. |
[Table 2. Parameters]

{#r_DashboardMessageHandler-publishFilter_String_String__table_bh3_nyc_lr} {#r_DashboardMessageHandler-publishFilter_String_String__table_ch3_nyc_lr__entry__2}

| Type | Description |
|-|-|
| void |   |
[Table 3. Returns]

{#r_DashboardMessageHandler-publishFilter_String_String__table_ch3_nyc_lr}  

    var my_dashboardMessageHandler = new DashboardMessageHandler("my_unique_id");
    <input id="onlyMine" type="button" value="Only mine" 
      onclick="my_dashboardMessageHandler.publishFilter('task','caller_idDYNAMIC90d1921e5f510100a9ad2572f2b477fe');"/>

## DashboardMessageHandler - publishMessage(Array filters) {#ariaid-title4}

Apply a custom interactive filter to multiple tables.
{#DashboardMsgHdlr-publishMessage_O__table_tgg_zjt_gtb__entry__3}

| Name | Type | Description |
|-|-|-|
| filters | Array | Array of filter objects that define the tables to filter and the filter criteria. [ { "table": String, "filter": String } ] |
| filters.table | String | Name of the table to filter. |
| filters.filter | String | Encoded query containing the filter criteria to apply to the table. |
[Table 4. Parameters]

{#DashboardMsgHdlr-publishMessage_O__table_tgg_zjt_gtb} {#DashboardMsgHdlr-publishMessage_O__table_ugg_zjt_gtb__entry__2}

| Type | Description |
|-|-|
| None |   |
[Table 5. Returns]

{#DashboardMsgHdlr-publishMessage_O__table_ugg_zjt_gtb}  
This jelly script filters the Incident and Problem tables to return records where the assignment group is Problem solving.

    <?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 dmh = new DashboardMessageHandler("aha_dmh");
     var filter = "cmdb_ci.sys_idINcdafbfc9db8f570466e0a345ca96198a"; 
     //this is the encoded query string
     var fullFilter = dmh.getFilterMessage('change_request',filter); 
     //creates a JSON object

     SNC.canvas.interactiveFilters.setDefaultValue({id: dmh.aha_dmh, filters:[fullFilter],}, false);
     var published = dmh.publishMessage([fullFilter]);
    </script>

    </j:jelly>

## DashboardMessageHandler - removeFilter() {#ariaid-title5}

Removes the current filter published by this DashboardMessageHandler object from all
reports on the dashboard.
{#r_DashboardMessageHandler-removeFilter__table_esc_kyc_lr__entry__3}

| Name | Type | Description |
|-|-|-|
| None |   |   |
[Table 6. Parameters]

{#r_DashboardMessageHandler-removeFilter__table_esc_kyc_lr} {#r_DashboardMessageHandler-removeFilter__table_fsc_kyc_lr__entry__2}

| Type | Description |
|-|-|
| void |   |
[Table 7. Returns]

{#r_DashboardMessageHandler-removeFilter__table_fsc_kyc_lr}  

    var my_dashboardMessageHandler = new DashboardMessageHandler("my_unique_id");
    <input id="removeFilter" type="button" value="Remove filter" 
      onclick="my_dashboardMessageHandler.removeFilter();"/>


