Assigned To feild should be greyed out if I am not member of the group
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
Suppose I am part of Group A. I want to assign the incident to Group B.
If I am not part of Group B, then Assigned to feild should be greyed out. And I should not be allowed to assign it to any individual from Group B.
How can I achieve this?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
You can also use a UI Policy:
Condition: The user is not a member of the group
Action: Set the Assigned to field to read-only
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
an hour ago
so what did you start with and where are you stuck?
-> onChange of Group field do GlideAjax and check logged in user is member of that group and then make readonly
OR
-> onChange of Group field use GlideRecord with callback and check logged in user is member and then make readonly
function onChange(control, oldValue, newValue, isLoading, isTemplate) {
if (isLoading || newValue === '') return;
var group = newValue;
var user = g_user.userID;
// Helper: quickly check if user is in group
var gr = new GlideRecord('sys_user_grmember');
gr.addQuery('group', group);
gr.addQuery('user', user);
gr.query(checkRecord);
function checkRecord(gr) {
if (gr.hasNext()) {
g_form.setReadOnly('assigned_to', false);
} else {
g_form.setReadOnly('assigned_to', true);
g_form.clearValue('assigned_to'); // clear if needed
}
}
}
💡 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
32m ago
- Create New Display BR for the target table
Sample code (Advanced):
g_scratchpad.mem = gs.getUser().isMemberOf('<sys_id of group B>');
Create a client script (onload or Onchange) as per your requirement:
Sample code:
if(g_scratchpad.mem)
{
{ g_form.setReadOnly('assifned_to',true);}
g_form.setReadOnly('assifned_to',false);
} else
