- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hello ServiceNow gurus, could you please help me ?
I've created a client script to auto populate the assignment_group based of the Assigned_to. In other words, you just have to type the fulfiller's name and his service group will get populated in the assignment_group. But that works well when the fulfiller only belongs to one service group.
My issue is when the fulfiller is a member of multiple groups. What I'd like to do is to only display the service groups he is a member of into the assignment_group.
Let say for example that "Abel tuter" is a member of Service Desk and IT Device support. When you enter "abel " in the assigned_to, we only want to see these two service groups in the assignment_group instead of the list of all available service group (as shown in the pictures below)
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hi @AhuelieW ,
This is just opposite of showing only member of group which selected.
First go through the this you tube video Assignment group and Assignee .
The script include you can use.
getGroupOfAssignee: function(current) {
// Get selected assignee user sys_id from the form
var userId = current.assigned_to || '';
if (!userId) {
// No assignee selected, return no groups or all groups as per your need
return "";
}
// Query sys_user_grmember where user=userId to get group sys_ids
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('user', userId);
gr.query();
var groupIds = [];
while (gr.next()) {
groupIds.push(gr.getValue('group'));
}
if (groupIds.length == 0) {
// User is not a member of any groups, return no records
return "";
}
// Build encoded query to filter assignment groups by user's groups and active status
return 'active=true^sys_idIN' + groupIds.join(',');
}
as explained in video call this function from dynamic reference qualifier.
Thanks,
Bhimashankar H
-------------------------------------------------------------------------------------------------
If my response points you in the right directions, please consider marking it as 'Helpful' & 'Correct'. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 weeks ago
Hi @AhuelieW ,
check these reference accepted solutions:
Currently by OOB, the assigned to members are determined by the selected assignment group. Therefore, your current requirement is to display the assignment groups when the 'assigned to' option is selected.
1) Open Data Dictionary of Assignment group. (Right click on assignment group field and select data dictionary).
1.1 Add assigned_to under dependence view section.
2) Open Data Dictionary of Assigned to.
2.1 Remove the dependent field value empty.
Thanks,
Pradeep
Regards,
Pradeep