Get the assigned to based on assignment group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2023 04:23 AM
Hi,
OOB assignment group and assigned to fields are reference fields.
I have written a script where based on assignment group assigned to members to shown in the reference.
My requirement is the user should have the capability to select multiple groups as well as multiple assigned to.
I have created list type assignment group and assigned to fields respectively.
But when I select the assignment groups then in assigned to all the users are visible.
I want the dependancy of assignment group in assigned to.
But it is not happening.
Please suggest some ideas how to proceed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2023 06:09 AM
on which table you are doing this?
OOB assigned to is already dependent on assignment group
what script did you start with and where are you stuck?
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2023 06:27 AM
Hi Ankur,
In oob it is for reference fields where we select single assignment group.
Currently I have created custom fields of Type LIST where user has option to select multiple groups and also same dependant group members.
I am not sure how to start
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-05-2023 06:33 AM
Unless you start you cannot learn
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-06-2023 02:09 AM
hi ankhur
I have tried the below script
var assignmentGroups = current.assignment_group.toString().split(',');
var gr = new GlideRecord('sys_user_grmember'); //gr.addEncodedQuery('group=8a4dde73c6112278017a6a4baf547aa7^ORgroup=d625dccec0a8016700a222a0f7900d06');
gr.addQuery('group', 'IN', assignmentGroups);
gr.query();
var userIDs = [];
while (gr.next()) {
userIDs.push(gr.getValue('user'));
}
gs.log(userIDs);
return 'sys_idIN' + userIDs.join(',');
When tried backend i am getting the sys_ids of all the group members.
But in assigned_to field the list reference is showing as empty.
I have written reference qualifier on assigned_to field