How to combine an advanced reference qualifier with a simple encoded query

Brett14
Giga Expert

Community,

I need to update our assignment group reference qualifier for Change Management.  Obvisouly I will need to do a dictionary override so that it is just for Change.

Can I do this below

javascript:new BackfillAssignmentGroup().BackfillAssignmentGroup() + typeNOT LIKE0c32e84cdbc95300ec5a70c08c961979

I am getting all the assignment groups now.

13 REPLIES 13

The list is coming up blank when selecting from assignment group

you mean after you add this condtion you are getting blank?

If yes, then check once if the groups those are returned from Script include all might be having the same type which you are excluding.

The script include is the basic example that ServiceNow provides as an example to backfill assignment groups that users are in. 

 

var BackfillAssignmentGroup = Class.create();
BackfillAssignmentGroup.prototype = Object.extendsObject(AbstractAjaxProcessor, {

BackfillAssignmentGroup:function() {
var gp = ' ';
var a = current.assigned_to;

//return everything if the assigned_to value is empty
if(!a)
return;
//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 (gp.length > 0) {
//build a comma separated string of groups if there is more than one
gp += (',' + grp.group);
}
else {
gp = grp.group;
}
}
// return Groups where assigned to is in those groups we use IN for lists
return 'sys_idIN' + gp;
},
type: 'BackfillAssignmentGroup'
});

Yifeng Zhang
Mega Expert

If all else fails... in script query your table using glide record and find exactly the records you want to return, and return a concatenated string like :

 

"Sys_idINsysid1,sysid2,sysid3...

 

as reference qualifier.