How to apply dynamic filters to data visualization component in UI builder?

Abhinandan Pati
Giga Guru

Hello experts,

I am trying to apply dynamic filter to data visualization components like Donut/Pie charts in UI builder. We don't have dynamic data binding filter option in Data Sources selected on Data Visualization component. We can configure only static filters like 'Active=true' in data sources that are used in Pie charts/Donut reports.

I am trying to apply dynamic filter on Pie Chart created on Entity overview page of Risk workspace. I would like to show ALE data of a specific entity or current entity on Pie chart instead of showing ALE data of all entities. I have sys_id of current entity in context object:@context.props.sysId. Is there any way to use this sys_id in a data visualization component to show data of current entity?

I went through below article but I could not understand the way it is relating a filter component to Data Visualization component.

UI Builder - Setting up dynamic filters on a data visualization using mergePARFilters - Support and ...

In multiple OOB pages reports, I see that ServiceNow is using 'Apply par filter' client script to filter such data visualization reports but I could not figure out the relationship between filter component and data visualization component.

Please let me know if you have implemented something similar in ServiceNow.

@Chuck Tomasi @Brad Tilton @Jeremy Duncan @Kreg Steppe : I would greatly appreciate it if you could share your thoughts and inputs on this. 

Thanks,

Abhinandan

8 REPLIES 8

Arnoud Kooi
ServiceNow Employee
ServiceNow Employee

If the data source component has an encoded query property, set that to a state parameter.

Update the state parameter via the change (or equivalent) event of the dynamic filter.

Thanks @Arnoud Kooi for your inputs. Unfortunately there is no way to apply encoded query in data sources. 

I checked and it indeed works diffrent.

You must add a Dashboard Viewport Component

From there click Open Dashboard Builder

On that page, you should build the actual dashboard, and add the Filter and Data Visualisation components.

After saving, in the UI Builder page, assign the Dashboard Viewport Component to the new created dashboard.

Now with the default settings, your data visualisations should follow the filters.

Yes @Arnoud Kooi , I did the same by referring Create a Reference filter for Next Experience (servicenow.com) And as you said the filter get applied to data visualization component in dashboard automatically.

But still I am unable to achieve my actual requirement. Requirement was to show specific field data of only current record/entity in Pie chart form. And as I mentioned I have the sys_id of the current record in context object:@context.props.sysId. There is no provision to use dynamic value even in dashboard builder filter. Is there any way to set the default value or only one dynamic value in a filter of a Dashboard?

Thanks for your time on this!