- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2023 12:13 AM
Hi Team,
On the INC form i want 'assigned to' field pop-up table doesn't show any user until we have 'assignment group' filled. I want to achieve this via Advance reference qual calling script include function.
If above assignment group is empty it should not show users in 'assigned to' field pop table as below:
Thanks in Advance
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2023 04:34 AM
Hi @Vartika Goel .
Follow below steps
1. Create script include and write below code.
var getUser = Class.create();
getUser.prototype = {
initialize: function() {},
getsys: function(group_Name) {
var arr = [];
var grSUG = new GlideRecord('sys_user_grmember');
grSUG.addEncodedQuery("group.sys_id=" + group_Name);
grSUG.query();
while (grSUG.next()) {
arr.push(grSUG.user.toString());
}
return 'sys_idIN' + arr.toString();
},
type: 'getUser'
};
2. Right click on "Assigned to" field and open dictionary override and search for incident table and make following changes.
enable the checkbox and make dependent field empty.
Override dependent
Make sure the check box enabled "Override reference qualifier" and write the code "javascript:new global.getUser().getsys(current.assignment_group);" under "Reference Qualifier" field.
Please change script include and function name as per the naming standard.
and write the code under "reference qualifier".
Please mark the answer correct if it helps.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2023 04:46 AM
create script include and then create dictionary override for that assigned to field
function getMembers(group){
var arr = [];
var gr = new GlideRecord("sys_user_grmember");
gr.addQuery("group", group);
gr.query();
while (gr.next()) {
arr.push(gr.getValue('user'));
}
if(group == '')
return '';
else
return 'sys_idIN' + arr.toString();
}
Dictionary override -> in related list create new, select table and override ref qualifier
If my response helped please mark it correct and close the thread so that it benefits future readers.
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2023 04:34 AM
Hi @Vartika Goel .
Follow below steps
1. Create script include and write below code.
var getUser = Class.create();
getUser.prototype = {
initialize: function() {},
getsys: function(group_Name) {
var arr = [];
var grSUG = new GlideRecord('sys_user_grmember');
grSUG.addEncodedQuery("group.sys_id=" + group_Name);
grSUG.query();
while (grSUG.next()) {
arr.push(grSUG.user.toString());
}
return 'sys_idIN' + arr.toString();
},
type: 'getUser'
};
2. Right click on "Assigned to" field and open dictionary override and search for incident table and make following changes.
enable the checkbox and make dependent field empty.
Override dependent
Make sure the check box enabled "Override reference qualifier" and write the code "javascript:new global.getUser().getsys(current.assignment_group);" under "Reference Qualifier" field.
Please change script include and function name as per the naming standard.
and write the code under "reference qualifier".
Please mark the answer correct if it helps.