Only the user who is part of the assignment group should be selected in the assigned to field.

jaisankar
Mega Contributor

Hi All,

I'm trying to create a new Incident , when i select the assignment group field the selection of assigned to field will be restricted to select the person who belongs to the assignment group.

Also, when the user select the assigned to field first and then the assignment group which the user doesn't belongs to, the selected user will be removed from the assigned to field when the assignment groups field is filled. Then it will allow to select only the users who are part of the assignment group.

Result- Only the user who is part of the assignment group should be selected in the assigned to field.

But the issue is when i try to create incident by selecting all the mandatory fields including the assignment group( which i'm not part of ) and without selecting the assigned to field and try to click on the template which i have created it pulls the assigned to value from the Template since i have given (javascript:gs.getUserID()) in the template. Hence, it pulls my name and i'm able to submit the incident. It should not happen?

It should not allow me to submit the Incident , since i'm not part of the assignment group. Please help with the solution, how to restrict this,

Your help is highly Appreciated!

Thanks,

Prem

4 REPLIES 4

Baggies
Kilo Guru

Hello , have you tried this on the Assigned To dictionary entry? And then create an onchange client script to empty the assigned to field when the assignment group changes? Let me know if you need the script.

find_real_file.png

 

Hi Baggies,

 

Thanks For Your Reply!

 

The Assigned_to field is dependent on the Assignment_Group only as you mentioned. Also, the Onchange client script is there to empty the assigned to Field. 

 

When the assignment group is filled ,it makes empty the assigned to field (on change client script already exists)and it allows to select only the person belongs to the assignment group when it is manually entered.

 

But What actually happens is , i'm filling the assignment group (which i'm not part of) and all the mandatory fields and also note i'm not selecting the assigned to field. In between i applies the template which i have created, in template i have defined the assigned to as - (javascript:gs.getUserID()). Hence, it is pulling my name in the assigned to field. It is not checking the condition whether the user is part of the assignment group. Now i'm able to submit the incident without any restriction.

 

It should not happen. It should check for the assigned to person is part of the assignment group.

 

Please let me know if you need any more information from my end. Also, please help with the solution how can we restrict.

 

Thanks,

Prem 

jaisankar
Mega Contributor

Hi Baggies,

 

Thanks For Your Reply!

 

The Assigned_to field is dependent on the Assignment_Group only as you mentioned. Also, the Onchange client script is there to empty the assigned to Field. 

 

When the assignment group is filled ,it makes empty the assigned to field (on change client script already exists)and it allows to select only the person belongs to the assignment group when it is manually entered.

 

But What actually happens is , i'm filling the assignment group (which i'm not part of) and all the mandatory fields and also note i'm not selecting the assigned to field. In between i applies the template which i have created, in template i have defined the assigned to as - (javascript:gs.getUserID()). Hence, it is pulling my name in the assigned to field. It is not checking the condition whether the user is part of the assignment group. Now i'm able to submit the incident without any restriction.

 

It should not happen. It should check for the assigned to person is part of the assignment group.

 

Please let me know if you need any more information from my end. Also, please help with the solution how can we restrict.

 

Thanks,

Prem 

Baggies
Kilo Guru

Hello Prem,

you could add a client script to the Incident form to check if the Assigned To is a member of the Assignment Group. If not, then clear out the value. I have something like this:

find_real_file.png

 

 

function onChange(control, oldValue, newValue, isLoading, isTemplate){
   if (isLoading || newValue == ''){
       return;
   }
    g_form.hideFieldMsg('assigned_to');
   var AssigneTo = g_form.getValue('assigned_to');
   if (AssigneTo == ''){ //not needed if there is no tech
       return;
   }
    
   var grplist = new GlideRecord('sys_user_grmember'); //this table lists all group-member associations
   grplist.addQuery('group',newValue);
   grplist.addQuery('user',AssigneTo);
   grplist.query();
   if (grplist.next()){ //if current tech found in the new group, stop
       return;
   }
   g_form.clearValue('assigned_to'); //if current tech wasn't found in the new group, blank assigned_to
   g_form.showFieldMsg('assigned_to', 'User is not member of Assignment Group - clearing Assigned To value','error');
}