dynamic filter on the incident table

Alon Grod
Tera Expert

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.

Screenshot 2024-07-08 at 18.23.25.png

Screenshot 2024-07-08 at 18.24.11.png



This is before using the filter:

Screenshot 2024-07-08 at 18.24.41.png



After using the filter(for some reason Im only getting incident that created by Abel but Dolev is also from my department):

Screenshot 2024-07-08 at 18.25.31.png

1 ACCEPTED SOLUTION

Sandeep Rajput
Tera Patron
Tera Patron

@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.

 

Screenshot 2024-07-08 at 9.36.42 PM.png

Screenshot 2024-07-08 at 9.37.11 PM.pngScreenshot 2024-07-08 at 9.37.42 PM.png

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.

 

Screenshot 2024-07-08 at 9.41.55 PM.png

 Hope this helps

View solution in original post

5 REPLIES 5

Sandeep Rajput
Tera Patron
Tera Patron

@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.

 

Screenshot 2024-07-08 at 9.36.42 PM.png

Screenshot 2024-07-08 at 9.37.11 PM.pngScreenshot 2024-07-08 at 9.37.42 PM.png

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.

 

Screenshot 2024-07-08 at 9.41.55 PM.png

 Hope this helps