Creating a Custom multi-choice Interactive Filter

Rohit8
Tera Expert

Hello,

We have a dashboard for a particular Business Unit with multiple reports of Business Applications for that particular BU.

This is what the filters look like:

find_real_file.png

The Primary Portfolio is a reference field that is sourced off the "Portfolios" table, while the Other Portfolios is a List collector field that can have multiple Portfolios.

find_real_file.png

We now have the requirement to make this dashboard work for all BUs by adding an Interactive filter (multi-choice) with which they can select their BU/s and see the dynamic reports. It would have been easy requiring a single multi-choice Interactive filter for "Portfolios" but it can only work with Primary Portfolio at a time. It doesn't work with Other Portfolios simultaneously and doesn't have the mapping option to that field either.

find_real_file.png

Is there a way to create a custom Interactive filter (using Dynamic Content block) with multi select dropdown that works with the reports adding both the conditions at the same time?

Thank you.

4 REPLIES 4

Thanks, Adam. Is there any other way apart from the custom table route? With the help of your K19 video, I was able to create a custom widget that works with the name of the Application.

 

find_real_file.png

<?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("businessapplookupbyname");

		function searchForStrings (str) {
		var filter_message = {};
		filter_message.id = "businessapplookupbyname";
		filter_message.table = "cmdb_ci_business_app";

		<!--     Add your own filter query logic here -->
		filter_message.filter = "nameLIKE" + str;
		SNC.canvas.interactiveFilters.setDefaultValue({
		id: filter_message.id,
		filters: [filter_message]
		}, false);
		my_dashboardMessageHandler.publishFilter(filter_message.table, filter_message.filter);
		}

	</script>   
	<br/>
	<!--<input id="myCustomSearchString" type="text" value="" onChange="searchForStrings(this.value);" />-->


	<div class="form-group row" style = "margin-left:0px;margin-right:0px">


		<div class="col-md-8 col-md-offset-2">

			<input id="myCustomSearchString" placeholder="Search Business Applications" type="text" value="" onChange="searchForStrings(this.value);" class="form-control" />    

		</div>



	</div>


</j:jelly>

I was hoping to create something similar but wasn't able to find a way to add a choice dropdown.

 

Adam Stout
ServiceNow Employee
ServiceNow Employee

You have to loop through the selected values and add an ORnameLIKE.  The list is a csv, so is you multiselect.  With a single value, LIKE works, but not with a multiple as you would have to match the order too.

Split "str" on , then loop through those in a single pass.  This can get weird depending on your other filters as you need to make sure you use ^NQ and ^EQ correctly.  I would be a query string on the table manually with on the list to see what it looks like when you do multiple selected likes on a list view.

Thanks a lot. I'll give this a try.