Built something you're proud of? Tell the story. A quick G2 review of App Engine or Build Agent helps other developers see what's possible on ServiceNow. Share your experience.

Assignment group field should show limited groups

Not applicable

Hello everyone!
I was tasked to hide certain groups from the assignment group field. This should be done pretty easily with a dictionary override. But since there are several groups involved I cannot just exclude group type A from the reference qualifier or else the users won't be able to select their groups. Before the ref. qualifier was set up to: Type contains group A OR type contains group B. Now the requirement is to make only Group B available if company is X showing only the results needed for end users working on the incident to select.
How can I achieve this? I have tried a couple script includes but I could not achieve the result intended.

I have attached the scripts for reference.

6 REPLIES 6

Not applicable
 

Not applicable

var ReferenceQualifierHelper = Class.create();
ReferenceQualifierHelper.prototype = {

backfillAssignmentGroup: function() {
var assigneeGroupsQualifier = '';
var company = current.company;

if (!company)
return;

var availableGroups = [];
if (company == 'X') {
availableGroups = ['X Call Desk Agent', 'X First Line Agent', 'Field Services of X Lux', 'Field Services of X Sgp', 'Field Services of X Lie', 'IT & Security governance', 'Field Services of X'];
} else {
availableGroups = [];
}

availableGroups.forEach(function(group, index) {
if (index == 0) {
assigneeGroupsQualifier = 'sys_idIN' + group;
} else {
assigneeGroupsQualifier += ',' + group;
}
});

gs.log('DP: RefQual = ' + assigneeGroupsQualifier);
return assigneeGroupsQualifier;
},
type: 'ReferenceQualifierHelper'
};

AniketC85155510
Kilo Patron

Hello @Community Alums ,

Please give a try to the modified script below and see how its working for you.

var ReferenceQualifierHelper = Class.create();
ReferenceQualifierHelper.prototype = {

    backfillAssignmentGroup: function() {
        var assigneeGroupsQualifier = '';
        var company = current.company;

        if (!company)
            return;

        var availableGroups = [];
        if (company == 'X') {
            availableGroups = ['X Call Desk Agent', 'X First Line Agent', 'Field Services of X Lux', 'Field Services of X Sgp', 'Field Services of X Lie', 'IT & Security governance', 'Field Services of X'];
        } else {
            // If the company is not X, make no groups available
            availableGroups = [];
        }

        if (availableGroups.length > 0) {
            assigneeGroupsQualifier = 'sys_idIN' + availableGroups.join();
        }

        gs.log('DP: RefQual = ' + assigneeGroupsQualifier);
        return assigneeGroupsQualifier;
    },
    type: 'ReferenceQualifierHelper'
};

 

 

Please Mark Correct if this solves your query and also mark 👍Helpful if you find my response worthy based on the impact.

 

Thanks & Regards,

Aniket.

Not applicable

Hello @AniketC85155510 ,
Unfortunately it is still presenting all of the other groups. 
If there is any information that I can provide that might be relevant please do not hesitate to ask.