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.

need to make assignment group visible to only specific group members only.

bhupendra paree
Tera Contributor

Hello All,

 

I want to hide an assignment group for specific groups members (so that they cant assign tickets to my group) or 

 

in other words, I want to make an assignment group visible to a specific group members only and not every one other than those members. 

 

How can i achieve it (for any form - assignment group field value), please advise.

3 ACCEPTED SOLUTIONS

Ankur Bawiskar
Tera Patron
Tera Patron

@bhupendra paree 

you can use advanced ref qualifier on that field

something like this

javascript: var query = ''; if(gs.getUser().isMemberOf('Group A')) query = 'sys_id!=groupSysIdYouWantToHide'; query;

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

View solution in original post

Subham Mundra1
Tera Expert

Hi @bhupendra paree ,

 

You can modify and use the below code in your "Assignment Group" advanced reference qualifier:-

 

javascript&colon; (gs.getUser().isMemberOf("<group name who should see all the groups>")) ? 'active=true' : 'active=true^sys_id!=<sysId of the group you want to hide>' ;

 

If you find this helpful, mark my answer helpful.

 

Regards,

Subham

View solution in original post

Gunjan Kiratkar
Kilo Patron
Kilo Patron

Hi @bhupendra paree ,

Use below script include and dictionary override :

Script Include :

var assignmentGroupRestrictions = Class.create();
assignmentGroupRestrictions.prototype = {
    initialize: function() {
    },
	
	hideAssignmentGroup : function (){
		if (gs.getUser().isMemberOf('Database') || gs.getUser().isMemberOf('Software')){ //Enter group names here from which you wanted to hide the assignment groups
		return 'sys_id!=477a05d153013010b846ddeeff7b1225^sys_id!=019ad92ec7230010393d265c95c260dd'; //Copy encoded query from group table by entering sys_id of groups which you don't want to show at assignment group level. (Make query as sys_id is not 477a05d153013010b846ddeeff7b1225 AND sys_id is not 019ad92ec7230010393d265c95c260dd)
		} 
	},

    type: 'assignmentGroupRestrictions'
};

 

GunjanKiratkar_0-1693415198839.png

 

Override Reference Qualifier :-

GunjanKiratkar_1-1693415237397.png

 


Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy

View solution in original post

7 REPLIES 7

This seems to be referring to a script include, which will return a encoded query after running few logics. you can try and incorporate the mentioned code snippet in the existing script include. The code snippet I have mentioned is nothing but an IF statement.

Gunjan Kiratkar
Kilo Patron
Kilo Patron

Hi @bhupendra paree ,

Use below script include and dictionary override :

Script Include :

var assignmentGroupRestrictions = Class.create();
assignmentGroupRestrictions.prototype = {
    initialize: function() {
    },
	
	hideAssignmentGroup : function (){
		if (gs.getUser().isMemberOf('Database') || gs.getUser().isMemberOf('Software')){ //Enter group names here from which you wanted to hide the assignment groups
		return 'sys_id!=477a05d153013010b846ddeeff7b1225^sys_id!=019ad92ec7230010393d265c95c260dd'; //Copy encoded query from group table by entering sys_id of groups which you don't want to show at assignment group level. (Make query as sys_id is not 477a05d153013010b846ddeeff7b1225 AND sys_id is not 019ad92ec7230010393d265c95c260dd)
		} 
	},

    type: 'assignmentGroupRestrictions'
};

 

GunjanKiratkar_0-1693415198839.png

 

Override Reference Qualifier :-

GunjanKiratkar_1-1693415237397.png

 


Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy

Solution seems to be perfect but i need to make Asgn.Group-A invisible to all other groups except few selected groups(e.g. B and C). i.e. for B and C group members only , Group A should be visible .

Putting all existing groups which should be restricted in if condition is not feasible, i think.

 

How can we overcome this , please advise.