Find your people. Pick a challenge. Ship something real. The CreatorCon Hackathon is coming to the Community Pavilion for one epic night. Every skill level, every role welcome. Join us on May 5th and learn more here.

INTERACTIVE FILTER FOR GROUP USER

ARAVINDA11
Tera Contributor

HI TEAM,

I HAVE ADDED FILTER FOR MY INCIDENT DAHBOARD

I HAVE ADDED FILTER FOR assignment group instead of that how can i display group user value i mean

if incident has assigned with 1lakh uers i need to filter with incident assigned to user with the group of ABC it is not related to assingnment group not assignment group can be anything i want to add a filter for example

 

incidnet assigned to is admin1

assignment group is france

 

so i need to find if assigned to is admin1 contains group of ABC 

Only with the group with the users contains ABC i want to add a interactive filter how can i achieve

 

please note  using sys_user table we cannot dot walk to display and map to group user display how can i achieve or it is onlly possible way is following adding user id to the breakdown and display value

ARAVINDA11_0-1776573127918.png

 

1 REPLY 1

Naveen20
ServiceNow Employee

PA can't reverse dot-walk from sys_user back to sys_user_grmember, which makes this tricky. Here are the practical approaches:

Approach 1: Breakdown Mapping Script (Recommended)

This is the cleanest PA-native way. You create a breakdown on sys_user_group and use a Breakdown Mapping Script to connect each incident to the groups its assigned_to user belongs to.

Steps:

  1. Create a new PA Breakdown — set the table to sys_user_group, display field to name.

  2. On your existing PA Indicator (for incidents), go to the Breakdown tab and add a Breakdown Mapping. Select the breakdown you created above.

  3. In the Breakdown Mapping, set the Script field with something like:

// Breakdown Mapping Script
// Maps incident.assigned_to → sys_user_grmember → group
(function() {
    var assignedTo = current.assigned_to + '';
    if (!assignedTo) return [];

    var groups = [];
    var gr = new GlideRecord('sys_user_grmember');
    gr.addQuery('user', assignedTo);
    gr.query();
    while (gr.next()) {
        groups.push(gr.getValue('group'));
    }
    return groups;
})();
  1. Once the breakdown mapping is scored (via the PA data collector job), you can add this breakdown as an interactive filter on your dashboard — it will show group names, and selecting "ABC" will filter to only incidents where the assigned_to user is a member of group ABC.

Caveat: Breakdown mapping scripts run during PA data collection, so they can be slow if you have a very large incident volume. Also, the filter reflects data as of the last collection run, not real-time.


Approach 2: Custom Field + Business Rule (Simpler, More Performant)

If you need real-time filtering or have a very large dataset:

  1. Add a custom List field (e.g., u_assigned_to_groups) on the incident table referencing sys_user_group.

  2. Create a Business Rule (before insert/update, when assigned_to changes) that populates this field:

(function executeRule(current, previous) {
    var groups = [];
    var gr = new GlideRecord('sys_user_grmember');
    gr.addQuery('user', current.assigned_to);
    gr.query();
    while (gr.next()) {
        groups.push(gr.getValue('group'));
    }
    current.u_assigned_to_groups = groups.join(',');
})(current, previous);
  1. Create a PA Breakdown on incident.u_assigned_to_groups and use it as your interactive filter.

Downside: You need to backfill existing records and the field needs maintenance if users change groups.


Approach 3: Display Value on Breakdown (What You Mentioned)

Adding user sys_ids to the breakdown and overriding the display value is technically possible but messy — you'd still face the same mapping problem, and the filter would show user names rather than group names.


Bottom line: Approach 1 (Breakdown Mapping Script) is the most standard PA way to achieve this without modifying the incident table. If performance is a concern or you need near-real-time filtering, go with Approach 2. Both let you add the result as an interactive dashboard filter exactly like the one you already have for Assignment Group.