When a user selects Assignment Group, Assign to field should Auto populate.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2022 11:32 AM
When users is Selecting any Assignment group assign to field should Auto populate member from the Selected group.
In assign to field it should not allow the name of Opened by. if Opened by is member of that particular group.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2022 12:25 PM - edited ‎10-08-2022 12:26 PM
Hi @Rohith2
Firstly, As there is multiple group members so auto populating it won't be useful but OOTB its members are only shown in the choices. These was implemented by setting Dependent field as 'assignment_group' in Assigned To Dictionary Entry. So if this is your custom field or not already implemented, you can try this.
Secondly, If you want to exclude Opened By user if that is member of group, you can use Advanced type Reference Qualifier (which comes in Advance View) and can right below line:
javascript: 'sys_id!=' + current.opened_by;
Thanks
Anubhav Ritolia
ServiceNow Rising Star 2023
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-08-2022 11:51 PM
Hello,
Please write the Onchange client script on assignment group. So as soon as assignment group is selected it would autopopulate the assigned to field with someone from the group.
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') {
return;
}
var openedby = g_form.getValue('opened_by');
var member = new GlideRecord('sys_user_grmember');
member.addQuery('group', newValue);
member.addQuery('user', '!=', openedby);
member.query();
while (member.next()) {
var role = new GlideRecord('sys_user_has_role');
role.addQuery('role', '282bf1fac6112285017366cb5f867469');
role.addQuery('user', member.user);
role.setLimit(1);
role.query();
if (role.next()) {
g_form.setValue('assigned_to', role.user);
break;
}
}
}
Now if you want to not allow anyone to select assigned to having the same name as opened by configure dictionary for assigned to field and write the below in the Ref qualifier of selecting advance(screenshot below:-) . roles=itil should be present as that is OOB filter and should not be removed.
javascript: 'roles=itil^sys_id!=' + current.opened_by;
Please mark my answer as correct based on Impact.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎04-25-2023 01:49 PM