Skip to content

Instantly share code, notes, and snippets.

@cmcdevitt
Created August 4, 2022 19:45
Show Gist options
  • Select an option

  • Save cmcdevitt/f09331f4301959e2e6515b4a4bdc0ffe to your computer and use it in GitHub Desktop.

Select an option

Save cmcdevitt/f09331f4301959e2e6515b4a4bdc0ffe to your computer and use it in GitHub Desktop.
VR Assignment Rules using a Script for the Teams [cmdb_rel_team] table
/*
On a Configuration Item Table (i.e. CMDB) you can add a Teams[cmdb_rel_team] you can add a "Teams" Related List that can hold
multiple Assignment Groups.
This is how you access it in an assignment Rule
*/
function getAssignment(ci,group_type){
var default_assignment_group = '679434f053231300e321ddeeff7b12d8';//Set with gs.getProperty()
var teams = new GlideRecord('cmdb_rel_team');//Teams Table
teams.addEncodedQuery('group_type=' + group_type + '^ci=' + ci);
teams.setLimit(1);
teams.query();
while(teams.next()){
return teams.user_group;
}
//Else Return a Default Assignment Group
return default_assignment_group;
}
current.assignment_group = getAssignment(current.cmdb_ci,'security');
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment