- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2024 08:26 AM
Hi,
Im trying to create a dynamic filter when choosing the caller field on the incident table.
I want to show all incidents that created from callers that share department like the login user, but i had no luck.
This is before using the filter:
After using the filter(for some reason Im only getting incident that created by Abel but Dolev is also from my department):
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2024 09:12 AM
@Alon Grod Are you sure, if you are using the dynamic filter correctly. Here is how I created a dynamic filter to show the incidents from the user who are from my department.
Here is the script include code.
var GetUsersFromDepartment = Class.create();
GetUsersFromDepartment.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getMyDepartmentUsers:function() {
var userArray = [];
var glideUser = new GlideRecord('sys_user');
glideUser.addActiveQuery();
glideUser.addQuery('department', gs.getUser().getDepartmentID());
glideUser.query();
while (glideUser.next()) {
userArray.push(glideUser.getValue('sys_id'));
}
return userArray;
},
type: 'GetUsersFromDepartment'
});
Here is how I am calling this script include from the script field of the dynamic filter.
new global.GetUsersFromDepartment().getMyDepartmentUsers();
Here is how the dynamic filter should be applied on the incident list.
 Hope this helps
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2024 09:09 AM
Could you let me know if you are trying to filter the incidents where the department is currently logged in's department?
If my response helped you, please click on "Accept as solution" and mark it as helpful.
- Saloni

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2024 09:09 AM
If I've understood your requirement, you shouldn't need a complex script. The following should be sufficient
Then within the query builder
 
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2024 09:49 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-08-2024 09:51 AM
Please make sure the current logged in user has department on the user record.
If my response helped you, please click on "Accept as solution" and mark it as helpful.
- Saloni