show assignment group for analyst to assign assignment group based on department

vamshi2
Tera Contributor

Hi team,

 

i have requirement to show only department based assignment groups for assigning to assignment group based on current logged user --> groups department 

 

Please advice 

 

Thanks

1 ACCEPTED SOLUTION

This should give you all assignment groups where the department is the logged in user's groups department:

 

var UserGroupUtils = Class.create();
UserGroupUtils.prototype = {
    getUserGroupDepartments: function() {
        var userGroupDepartments = [];

        var grGroupMember = new GlideRecord('sys_user_grmember');
        grGroupMember.addQuery('user', gs.getUserID());
        grGroupMember.addQuery('group.active', true);
        grGroupMember.query();

        while (grGroupMember.next()) {
            // Replace u_department with the required field name
            var groupDepartment = grGroupMember.group.u_department.toString();
            userGroupDepartments.push(groupDepartment);
        }

        // Replace u_department with the required field name
        return 'u_departmentIN' + userGroupDepartments.toString(); // Query containing all assignment groups where u_department is one of the logged in user's groups department
    },

    type: 'UserGroupUtils '
};

 

View solution in original post

10 REPLIES 10

That additional query you added for ITIL type looks good to me. Just make sure the sys_id of the group type is correct, as long as you copy the query from the list view it should be fine.