- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
I have created two dynamic filters in ServiceNow:
- Member of IT Groups
- Not Member of IT Groups
In my instance, I have two IT groups:
- Service Desk
- Network
For example, Fred Luddy is a member of the Network group, so he is considered an IT user.
My requirement is: If a user like Fred Luddy (who belongs to an IT group) raises/creates an RITM, that record should appear in the report.
To achieve this, I created a dynamic filter and used it in the report condition. However, even after configuring everything and trying multiple approaches, the report is still not showing the expected records.
I have also attached screenshots of my configuration.
I need help understanding where the mistake is and why the records are not appearing, even though the user belongs to the IT group.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @karishmanat,
Add the following to the Dynamic Filter script:
new global.GroupFilterUtil().getGroupMembers()
Also, ensure that:
- The Script Include is marked as Client Callable.
- Sandbox is enabled for the Dynamic Filter.
Expected Result: The dynamic filter should return the group members from the GroupFilterUtil Script Include and populate the filter correctly.
If you found this response useful, please mark it as Helpful and accept it as the Solution to help others with similar questions.
Best regards,
Mariam Ahmed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @karishmanat ,
I think the issue is with how the dynamic filter is configured. Before building a custom solution, I'd also recommend checking whether an out-of-the-box (OOTB) dynamic filter can satisfy your requirement.
If you need to proceed with a custom dynamic filter, update your Script Include to return an array of user for example:
getGroupMembers: function() {
var userList = [];
var group1 = 'YOUR_GROUP_SYS_ID';
var group2 = 'YOUR_GROUP_SYS_ID';
var gr = new GlideRecord('sys_user_grmember');
gr.addEncodedQuery('group=' + group1+ '^ORgroup=' + group2);
gr.query();
while (gr.next()) {
userList.push(gr.getValue('user'));
}
return userList; // Returns an array of user Sys IDs
},
type: 'GroupFilterUtil'2. Configure the Dynamic Filter Option
Navigate to System Definition > Dynamic Filter Options and create a new record with the following values:
Label: IT Members
Script: new GroupFilterUtil().getGroupMembers();
Field type: Reference
Reference table: sys_user (since opened_by is a reference to the User table)
Available for filter: Checked
Save the record.
3. Apply the filter in the report
In the report condition builder, configure:
Opened by >is (dynamic) > IT Members
If you found this response useful, please mark it as Helpful and accept it as the Solution to help others with similar questions.
Best regards,
Mariam Ahmed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @karishmanat,
Add the following to the Dynamic Filter script:
new global.GroupFilterUtil().getGroupMembers()
Also, ensure that:
- The Script Include is marked as Client Callable.
- Sandbox is enabled for the Dynamic Filter.
Expected Result: The dynamic filter should return the group members from the GroupFilterUtil Script Include and populate the filter correctly.
If you found this response useful, please mark it as Helpful and accept it as the Solution to help others with similar questions.
Best regards,
Mariam Ahmed.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
yesterday
Hi @karishmanat
For this use case , easiest option would be create a Database view.
- Navigate to System Definition > Database Views.
- Create a new view (like u_ritm_it_user).
- Add the Requested Item [sc_req_item] table (Prefix: ritm)
- and the Group Member [sys_user_grmember] table (Prefix: gm).
- Add the Where clause: ritm.opened_by = gm.user
- Create your report on this new Database View and set the condition: Group is [Network]
Regarding Dynamic filter- Refer
KB0746219 Creating dynamic JavaScript filters in reports
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti