Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

Assignment groups, groups for roles.... why such confuse?

Brendan Hallida
Kilo Guru

Hi all,

Just want to start in saying that this could be me confusing myself!

From what I can gather - the best way to assign roles is to assign to groups, and then add the users to those groups.

This is fine and dandy - however we do not want to have these groups as assignment groups.

I followed the below wiki article, and assigned the group type as 'itil' and then modified the Assignment group's dictionary entry to contain type 'itil'

Configuring Group Types for Assignment Groups - ServiceNow Wiki

find_real_file.png

find_real_file.png

This works great, and as expected, until someone who is a member of more than one group.

What we have found is if you were to add an assignee in Assigned to before adding an assignment group, it will add the first group they are a member of, whether or not it is an assignment group with the 'itil' type or not.

Does anyone know how I can stop this from happening?

I hope I have explained this well enough......

Thanks in Advance!

Brendan

1 ACCEPTED SOLUTION

Hello Brendan,



Replace gr.group.type with group.type


View solution in original post

20 REPLIES 20

palmen
Tera Guru

You'll need to check the BackfillAssignmentGroup script include. You can probably edit it to only select groups with a specific type.


There will still be an issue with selecting the first group they find in case you belong to more than one group.


Reference Qualifiers - ServiceNow Wiki



backfill assignment group AND filter by group type


Hi Fred,



Thanks for your reply.



There will still be an issue with selecting the first group they find in case you belong to more than one group

I am totally fine with this - as long as they are only the assignment groups that I specify with the type 'itil'



It seems that we are not using a BackfillAssignmentGroup script, only a simple reference qualifier



find_real_file.png


Have you checked the Dictionary Override if you are using the BackfillAssignmentGroup script?



The simple Reference qualifier you have shouldn't automaticly add any group based on your assigned to, it should only limit it to what groups are selectable. If the assignment group is populated automaticly you have some script doing this. If not a dictionary override there might be an onChange Client Script doing it.


Brendan Hallida
Kilo Guru

HI all,



I am hoping that someone can help out.   Sorry for dredging up an old post, however I have found some free time to work on this.



I have found that our implementer has indeed created a client script that back fills when you add an assignee.



Table: Task


Type: OnChange


Field Name: Assigned To


Global: Yes



function onChange(control, oldValue, newValue, isLoading) {



  if (isLoading || newValue == '') {


  return;


  }


  var group = g_form.getValue('assignment_group');


  if (group == '') {


  var ga = new GlideAjax('KSTaskAjax');


  ga.addParam('sysparm_name', 'getPrimaryGroupInfo');


  ga.addParam('sysparm_assignedTo', newValue);


  ga.getXML(setAssignmentGroup);


  }



  function setAssignmentGroup(response) {



  var answer = response.responseXML.documentElement.getAttribute('answer');


  var obj = eval('(' + answer + ')');


  if (obj.groupCount == '0') {


  var _msg = obj.assignedName + ' is not a member of an assignment group, select another Assigned to';


  alert(_msg);


  g_form.setValue('assigned_to','', '');


  }



  if (obj.groupID != '') {


  if (obj.groupCount == 1) {


  // set a global to indicate that we are setting the assignment group


  // this will be checked in the onchange client script for assignment group


  global_ignoreAssignmentGroupChange = true;


  g_form.setValue('assignment_group', obj.groupID, obj.groupName);


  }



  g_form.hideFieldMsg('assignment_group');


  if (obj.groupCount > 1) {


  g_form.showFieldMsg('assignment_group',


  obj.assignedName + ' belongs to more than one group. Please select the correct group.', 'info');


  }


  }


  global_ignoreAssignmentGroupChange = false;


  }


}



Does anyone know how I can include a filter by the group type "itil" in this script?



Cheers,


Brendan