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

Mark Manders
Mega Patron

How are you relating departments to groups? 

 

And how well has this requirement been thought through? A ticket comes in at the ServiceDesk. That agent is of the IT department, but the ticket is meant for the HR department. He can't assign it, because he can't see the the HR department assignment groups. 

 

This will cause huge issues, because more often than not, it is a different department that needs to resolve a ticket, when the assignment group is changed.


Please mark any helpful or correct solutions as such. That helps others find their solutions.
Mark

Hi @Mark Manders 

 

Thanks for quick response

 

yes departments are tagged to the groups 

raj chavan
Tera Guru

Hi @vamshi2 
One way to achieve this is -Use a Reference Qualifier
Set the Reference Qualifier to Dynamic 

Navigate to System Definition > Dynamic Filter Options.
 Create a new dynamic filter on sys_user_group table
   answer = "department=" + gs.getUser().getDepartmentID();
 
Kindly mark it correct and helpful if it is applicable.

Thanks,

Raj

Hi @raj chavan 

 

Thanks for the reply but users are not directly mapped to department it is mapped via group