Assigned to should not be filled if Assignment Group Field is Empty on Incident Form

SNOW46
Tera Contributor

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

 

 

17 REPLIES 17

Service_RNow
Mega Sage

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

Service_RNow
Mega Sage

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

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

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.

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