hide user in dropdown
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
I want to hide a user that is in the "Assigned to" group. Since they are part of a group in "Assignment group", I am not able to hide them without removing them from the group all together. How do I go about changing this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
the assigned to field must be having dependency on the Assignment group and hence not directly possible
2 approaches
1) remove that dependency and use advanced reference qualifier and in the script include get all members of that group excluding that user and return those sysids
OR
2) keep the dependency as it is, use onSubmit client script or onChange client script and check if the selected user is the one which you don't want to be selected, if yes then throw field message with error
💡 If my response helped, please mark it as correct ✅ and close the thread 🔒— this helps future readers find the solution faster! 🙏
Ankur
✨ Certified Technical Architect || ✨ 10x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 weeks ago
If you have existing Reference Qualifier , update it . If not , follow this steps:
1)Navigate to the incident form,
- right-click the Assigned to field label, and select Configure Dictionary.
- Scroll to the Reference Qualifier section at the bottom
- Update the qualifier to call a Script Include that evaluates the chosen Assignment group and returns a filtered list of user Sys IDs:
javascript:
new UpdateAssignedTo().excludeGroupMembers(current.assignment_group);
2)
Navigate to System Definition > Script Includes->Click New
var UpdateAssignedTo = Class.create();
UpdateAssignedTo.prototype = {
initialize: function() {},
excludeGroupMembers: function(groupId) {
var userIds = [];
if (!groupId) return "";
var grMember = new GlideRecord('sys_user_grmember');
grMember.addQuery('group', groupId);
grMember.query();
while (grMember.next()) {
if (grMember.user.sys_id.toString() != 'YOUR_TARGET_USER_SYS_ID_HERE') // Exclude the specific user's sys_id here or better use sys_properties
{
userIds.push(gr.user.toString());
}
}
return "sys_idIN" + userIds.join(',');
},
type: 'UpdateAssignedTo'
};
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti