Assigned to should not be filled if Assignment Group Field is Empty on Incident Form
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2019 04:32 AM
Hi All,
I have one requirement that user cannot able to fill the Assigned To cannot be filled without Filling the Assignment Group.
Can anyone suggest me how to impose the restriction in SNOW?
Regards,
SNOW@Das

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2019 04:58 AM
Hi,
You can use a advanced reference qualifier on assignment group field which calls a script include containing below function.
function ReturnAssignmentGrp() {
var asgArray= [];
var ag = new GlideRecord('sys_user_grmember');
ag.addEncodedQuery('user='+current.assigned_to)
ag.query();
while(ag.next()) {
asgArray.push(ag.sys_id.toString());
}
}
return "sys_idIN"+asgArray;
}
Please mark correct if it is helpful.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2019 05:03 AM
Hi,
Try to below code:
var group_members = Class.create();
group_members.prototype = {
initialize: function() {
},
func1:function(a)
{
//gs.log(a);
var b=[];
var gr=new GlideRecord('sys_user_grmember');
gr.addQuery('group',a);
gr.query();
//gs.log('hi');
while(gr.next())
{
b.push(gr.getValue("user"));
}
return "sys_idIN"+b.toString();
},
type: 'group_members'
};
Call this reference qualifier in assignment group.
advanced:
javascript:new group_members().func1(current.assignment_group);
Please mark correct if it is helpful.
Thanks
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2019 05:41 AM
Hi,
Where should I define this Code?
Script Include or Business Rule?
Can you please post some screenshots with the configurations to be done.
Regards,
SNOW@Das
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
01-24-2019 05:58 AM
These script includes aren't doing what you want them to. The first is backfilling the assignment group based on the assigned to and the second is refining the assigned to field based on the content of the assignment group field.
Harsh and Vignesh's solutions will both prevent people from populating the assigned to field if the assignment group is empty as per your requirement. I would go with Vignesh's UI policy idea, that way users don't waste time searching for a user only to be told they have to fill in the assignment group first.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2019 06:52 AM
HI,
Please put the same code in script include.
Call this reference qualifier in assignment group.
advanced:
javascript:new group_members().func1(current.assignment_group);
Thanks