Add Assignment group choice to Problem Form

David Santel
Giga Guru

My assignment groups are not showing up for problems. How do I populate the same assignment groups for problem that i have setup for incidents. 

 

 

find_real_file.png

find_real_file.png

1 ACCEPTED SOLUTION

Hi David,

There is a field called "Type" on the Group form. Press the security lock icon next to it and you'll see a search box. Type in "Problem" and then select to add as a group "Type". Press the security lock icon to close the type box then Save the group record.

Navigate to the Problem table and check if the group you just assigned the "Problem" type is now showing as an assignment group.

Brent

 

View solution in original post

16 REPLIES 16

Hi David,

Take a look at the "BackFillAssignmentGroup" script include (used to override the reference qualifier). You need to review the "BackFillAssignmentGroup" function in this script include for any logic that would prevent the groups from being properly displayed in tables other than "incident".

Is it possible to post the script include for me to take a look at?

Brent

P.S. If my suggestion helped then please mark as helpful and/or correct so other community members can benefit from this information.

var BackfillAssignmentGroup = Class.create();
BackfillAssignmentGroup.prototype = {
initialize: function() {
},

BackfillAssignmentGroup:function() {

var gp = ' ';
var a = current.assigned_to;
var groupType = returnGroup();

//If there is no name in the assigned_to field then just display a list of all groups with the right type.
if (!a) {
var gr = new GlideRecord('sys_user_group');
gr.addQuery('type','CONTAINS',groupType);
gr.query();

while(gr.next()) {

if (gp.length > 0) {
//build a comma separated string of groups if there is more than one
gp += (',' + gr.sys_id);
}
else {
gp = gr.sys_id;
}
}
return 'sys_idIN' + gp;
}

//If there is a name in the assigned to then return only those groups that they are a part of which also matches the group type.

else {
//sys_user_grmember has the user to group relationship
var grp = new GlideRecord('sys_user_grmember');
grp.addQuery('user',a);
grp.query();
while(grp.next()) {
if(grp.group.type.indexOf(groupType) > -1){
if (gp.length > 0) {
//build a comma separated string of groups if there is more than one
gp += (',' + grp.group);
}
else {
gp = grp.group;
}
}
}


return 'sys_idIN' + gp;
}}
}
//And here is the returnGroup function portion:
function returnGroup() {
var tt = current.getTableName();
var type = '';
var tableTypes=[];

tableTypes[0] = {table:'incident', typeID:'d6c18d456f83c100ad775ddd5d3ee4bb'};
tableTypes[1] = {table:'sc_task', typeID:'74af88c6c611227d0066386e74dc853d'};
tableTypes[2] = {table:'task', typeID:'74af88c6c611227d0066386e74dc853d'};
tableTypes[3] = {table:'problem', typeID:'c8d18d456f83c100ad775ddd5d3ee4c7'};
tableTypes[4] = {table:'problem_task', typeID:'c8d18d456f83c100ad775ddd5d3ee4c7'};
tableTypes[5] = {table:'change_request', typeID:'d6d18d456f83c100ad775ddd5d3ee4ec'};
tableTypes[6] = {table:'change_task', typeID:'d6d18d456f83c100ad775ddd5d3ee4ec'};
tableTypes[7] = {table:'rm_sprint', typeID:'1bff3b1493030200ea933007f67ffb6d'};
tableTypes[8] = {table:'rm_story', typeID:'1bff3b1493030200ea933007f67ffb6d'};


for(j = 0; j < tableTypes.length; j++){
//Loop through list of tableTypes
if(tableTypes[j].table == tt){
type = tableTypes[j].typeID;
break;
}
}

if(type != ''){
return type;
}
}

The change table works correctly. Any idea why Problem not working?

var BackfillAssignmentGroup = Class.create();
BackfillAssignmentGroup.prototype = {
initialize: function() {
},

BackfillAssignmentGroup:function() {

var gp = ' ';
var a = current.assigned_to;
var groupType = returnGroup();

//If there is no name in the assigned_to field then just display a list of all groups with the right type.
if (!a) {
var gr = new GlideRecord('sys_user_group');
gr.addQuery('type','CONTAINS',groupType);
gr.query();

while(gr.next()) {

if (gp.length > 0) {
//build a comma separated string of groups if there is more than one
gp += (',' + gr.sys_id);
}
else {
gp = gr.sys_id;
}
}
return 'sys_idIN' + gp;
}

//If there is a name in the assigned to then return only those groups that they are a part of which also matches the group type.

else {
//sys_user_grmember has the user to group relationship
var grp = new GlideRecord('sys_user_grmember');
grp.addQuery('user',a);
grp.query();
while(grp.next()) {
if(grp.group.type.indexOf(groupType) > -1){
if (gp.length > 0) {
//build a comma separated string of groups if there is more than one
gp += (',' + grp.group);
}
else {
gp = grp.group;
}
}
}


return 'sys_idIN' + gp;
}}
}
//And here is the returnGroup function portion:
function returnGroup() {
var tt = current.getTableName();
var type = '';
var tableTypes=[];

tableTypes[0] = {table:'incident', typeID:'d6c18d456f83c100ad775ddd5d3ee4bb'};
tableTypes[1] = {table:'sc_task', typeID:'74af88c6c611227d0066386e74dc853d'};
tableTypes[2] = {table:'task', typeID:'74af88c6c611227d0066386e74dc853d'};
tableTypes[3] = {table:'problem', typeID:'c8d18d456f83c100ad775ddd5d3ee4c7'};
tableTypes[4] = {table:'problem_task', typeID:'c8d18d456f83c100ad775ddd5d3ee4c7'};
tableTypes[5] = {table:'change_request', typeID:'d6d18d456f83c100ad775ddd5d3ee4ec'};
tableTypes[6] = {table:'change_task', typeID:'d6d18d456f83c100ad775ddd5d3ee4ec'};
tableTypes[7] = {table:'rm_sprint', typeID:'1bff3b1493030200ea933007f67ffb6d'};
tableTypes[8] = {table:'rm_story', typeID:'1bff3b1493030200ea933007f67ffb6d'};


for(j = 0; j < tableTypes.length; j++){
//Loop through list of tableTypes
if(tableTypes[j].table == tt){
type = tableTypes[j].typeID;
break;
}
}

if(type != ''){
return type;
}
}

Hi David,

In the returnGroup function there are some stipulations around "typeID" that must be added to the groups to be shown on each table. The sys_id of the group type is 'c8d18d456f83c100ad775ddd5d3ee4c7' for the problem table. Check which group type this sys_id belongs to by typing the following in the "Filter navigator" and hitting enter.

sys_user_group_type.LIST

Then use the condition builder to find the group "type" that needs to be added to groups that can be assigned problem tickets

find_real_file.png

Add the appropriate group type to the groups and they should then start showing up as assignment groups on the problem table:

find_real_file.png

Let me know if that worked for you.

Brent

P.S. If my suggestion helped then please mark as helpful and/or correct so other community members can benefit from this information.

I added ITIL User and do not see anyone under assignment group on problem form

find_real_file.png