- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-10-2024 11:51 PM - edited 12-11-2024 12:21 AM
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
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-11-2024 03:23 AM
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 '
};
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
12-13-2024 05:02 AM - edited 12-13-2024 05:02 AM
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.