Did you know that we can filter Kibana Visualizations and Dashboards using PeopleCode? Yes, thanks to a new feature that was introduced in PeopleTools 8.59. This is one of my favorite features in this release!

Why do we need this? PeopleTools 8.59 provides customers the flexibility to filter data in a visualization based on a context by using an application class, which applies filters through PeopleCode. Think of it as an option to dynamically control the filter options based on the user context.

How do we make this work? Very easy! We create an application class that extends PTSF_KIBANA:DashboardFilters and write our filter logic in the GetDashboardFilter method. Here is a super simple application class implementation with a ‘City’ filter.

Sample Application Class PeopeCode: SV_KIBANA_FILTERS.ApplicationDetails.CityFilter.OnExecute


import PTSF_KIBANA:DashboardFilters;
import PTSF_KIBANA:FilterValues;

class CityFilter extends PTSF_KIBANA:DashboardFilters
   method GetDashboardFilter(&sCrefReferer As string, &sDashboardName As string, &nMode As integer) Returns array of PTSF_KIBANA:FilterValues;
end-class;

method GetDashboardFilter
   /+ &sCrefReferer as String, +/
   /+ &sDashboardName as String, +/
   /+ &nMode as Integer +/
   /+ Returns Array of PTSF_KIBANA:FilterValues +/
   /+ Extends/implements PTSF_KIBANA:DashboardFilters.GetDashboardFilter +/
   
   Local array of PTSF_KIBANA:FilterValues &filter;
   Local PTSF_KIBANA:FilterValues &kibCondition;
   &filter = CreateArrayRept(&kibCondition, 0);
   
   Local PTSF_KIBANA:FilterValues &countryFilter = create PTSF_KIBANA:FilterValues();
   &countryFilter.Equals().Key("City", "", True).Value("San Francisco");
   &filter.Push(&countryFilter);
   Return &filter;
end-method;


For more details, please refer the following resources in PeopleBooks:
DashboardFilters Class
FilterValues Class

Next, we can simply reference this application class on the Configure Kibana Dashboards page as shown below. In PeopeTools 8.59, we will find two additional configuration fields – ‘Full View App Class’ and ‘Tile View App Class’.



For more details, please refer the following resources in PeopleBooks:
Configuring a Dashboard as a Tile or Related Information
Specifying an Application Class

That’s it! Here is how it works.


HCM Application Details – Kibana Dashboard without PeopleCode Filter



HCM Application Details – Kibana Dashboard with PeopleCode Filter