Search bar missing within report on dashboard

joshdev
Kilo Explorer

I am building a dashboard.   On one of the tabs I've inserted a report from the Report module (which simply displays a bunch of fields/data).   I want the user to be able to search on a specific field (Configuration Item).   The user wants to be able to search for a specific CI.

What Ive tried:

Interactive Filter (configuration item).   This nearly broke the dashboard.   There are a 500k-1million+ records for CI and I nearly had to delete the tab and start over.  

Click into any CI displayed, and then the search bar under 'Configuration item' appears.   But the user does not want to do this.   He wants to be able to search directly from the Dashboard canvas.

Any ideas?

7 REPLIES 7

Arnoud Kooi
ServiceNow Employee
ServiceNow Employee

You probably just want to search for a part of the CI Name, not a exact refrence.


Take a look at Custom interactive filters.



I have set up an example for Incident table:


This searches for the CI name, default startswith, or contains, when starting with a *


find_real_file.png



Create a new Content block like:


find_real_file.png



Sample code:


<?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 dbh = new DashboardMessageHandler("incident_ci_name_like");


function doSearch(evt){


      if (evt === true || evt.which == 13){



  var fltr = $j('#tbxCiSearch').val();


  if (fltr.startsWith("*"))


  dbh.publishFilter('incident','cmdb_ci.nameLIKE' + fltr.replace("*",""));


  else


  dbh.publishFilter('incident','cmdb_ci.nameSTARTSWITH' + fltr);


  }


}


</script>




<div class="input-group">


  <input id="tbxCiSearch" class="form-control"


      type="search"


      onkeyup="doSearch(event)"


      placeholder="CI Name contains" />    


  <span class="input-group-btn">


  <button type="button" class="btn btn-primary" onclick="doSearch(true)">


  <span class="glyphicon glyphicon-search"></span>


  </button>


    </span>


</div>


</j:jelly>




Add it to dashboard via Content Blocks


find_real_file.png


joshdev Did you try this, did it help?


Hi Arnoud, I am trying to do something similar.  Would you be willing to collaborate via email?

Bharat Baghel
Tera Contributor

@Arnoud Kooi did this actually work for you?