Hiding a particular group in assigment group filed in incident form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
4 hours ago
how to hide a particular in group in assignment field in incident form, even when any group member tries to fill in assigned to field, the group shouldn't populate in assignment group field
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi @keerthana219 ,
If you want to prevent a specific group from being populated in the “Assignment Group” field, even when a member of that group is selected in the “Assigned To” field, you can achieve this by using Client Scripts + Business Rules.
Create an onChange Client Script on the Incident table for the Assigned To field.
Purpose:
Detect the selected user
Check their group
Clear Assignment Group if it is restricted
Script Example:
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || !newValue) {
return;
}
var ga = new GlideAjax('CheckUserGroup');
ga.addParam('sysparm_name', 'isUserInRestrictedGroup');
ga.addParam('sysparm_user', newValue);
ga.getXMLAnswer(function(response) {
if (response == 'true') {
g_form.clearValue('assignment_group');
g_form.showFieldMsg('assignment_group',
'This group is restricted and cannot be auto-assigned.',
'error');
}
});
}
Step 2: Script Include (Client Callable)
Create a Script Include to check whether the user belongs to the restricted group.
Make sure:
“Client Callable” is checked
Script Example:
var CheckUserGroup = Class.create();
CheckUserGroup.prototype = Object.extendsObject(AbstractAjaxProcessor, {
isUserInRestrictedGroup: function () {
var userId = this.getParameter('sysparm_user');
var restrictedGroup = 'RESTRICTED_GROUP_SYS_ID'; // Replace with actual sys_id
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('user', userId);
gr.addQuery('group', restrictedGroup);
gr.query();
return gr.hasNext();
}
});
Replace RESTRICTED_GROUP_SYS_ID with the actual sys_id of the group.
Step 3: Business Rule (Before Insert/Update)
Client Scripts only work in UI.
To prevent assignment through API, imports, or scripts, add a Business Rule.
Business Rule Setup:
Table: Incident
When: Before
Insert & Update: Checked
Script Example:
(function executeRule(current, previous) {
if (!current.assigned_to) {
return;
}
var restrictedGroup = 'RESTRICTED_GROUP_SYS_ID';
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('user', current.assigned_to);
gr.addQuery('group', restrictedGroup);
gr.query();
if (gr.hasNext()) {
current.assignment_group = '';
gs.addErrorMessage('Restricted group cannot be assigned automatically.');
current.setAbortAction(true);
}
})(current, previous);
If this answer resolved your question, please mark it as solved to help others in the community.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi @keerthana219 ,
1) click on assignment group field , open configure dictionary
2) add the filter condition
aslo you can add this condition
If you found my solution helpful, please mark it as Helpful or Accepted Solution...!
thanks,
tejas
Email: adhalraotejas1018@gmail.com
LinkedIn: https://www.linkedin.com/in/tejas1018
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Remember assignment_group field on INC is coming from parent task table
So you should not add reference qualifier on that field
Create dictionary override for that field for INC table and restrict the group
ServiceNow Dictionary Override | Introduction to ServiceNow Dictionary Override with Demo
💡 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 || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Please refer this links, see if it helps you:
