Hide Assignment group based on current user's assignment group.

Maxwell3
Kilo Guru

Hello Community,

I would like users who are members of 'Generic Group' and are currently logged in to have access and to be able to see all the Assignment groups available on the Incident form. On the other hand, if a user who is currently logged in, is not a member of the 'Generic group', the group name 'Hidden Group' shall be hidden from that user.

My organization already has a script include in the assignment group field reference qualifier. I created a script include and tried to use it in addition to the my organization's script include and I also tried to use mine by itself but it still did not work.

Reference Qualifier:

javascript: myGroupFilter();

Script Include:

var myGroupFilter = Class.create();
myGroupFilter.prototype = {
initialize: function() {

if (gs.getUserID().isMemberOf('Generic Group'))
{ // User Can see all records
return;
}

else
{
return 'name!=Hidden Group'; // If user is not a member of the Generic Group Name then HIDE this Assignment group field.
}

},

type: 'myGroupFilter'
};

 

Below is what I had, I removed my organization's script include but it still did not work?

javascript: myOrganizationScriptInclude()+myGroupFilter();

1 ACCEPTED SOLUTION

@Maxwell 

try

javascript: new MyOrgScriptInclude().getOrgQuery(current.u_org_field) + '^'+ new MyOrgScriptInclude().filter();

also change

var myGroupQuery = Class.create();
myGroupQuery.prototype = {
	
	filter: function(){
		if (!gs.getUser().isMemberOf('Generic Group Name')){
			return 'name!=Hidden Group';
		}else{
			return '';
		}
	},
	
	type: 'myGroupQuery'
};

View solution in original post

8 REPLIES 8

Mike Patel
Tera Sage

try

javascript: new myGroupFilter();

Mike Patel
Tera Sage

try 

javascript: new myGroupFilter().filter();

Script Include

var myGroupQuery = Class.create();
myGroupQuery.prototype = {
	
	filter: function(){
		if (!gs.getUser().isMemberOf('Generic Group Name')){
			return 'name!=Hidden Group'; 	
		}
	},
	
	type: 'myGroupQuery'
};

find_real_file.png

Mike,

I inserted the script include within my organization's pre-existing script include, the function works by itself but when I try to combine them in the ref qual, it does not work. All I did is add a plus sign to it. Is there another way of doing it?

 

javascript: new MyOrgScriptInclude().getOrgQuery(current.u_org_field) + new MyOrgScriptInclude().filter();

@Maxwell 

try

javascript: new MyOrgScriptInclude().getOrgQuery(current.u_org_field) + '^'+ new MyOrgScriptInclude().filter();

also change

var myGroupQuery = Class.create();
myGroupQuery.prototype = {
	
	filter: function(){
		if (!gs.getUser().isMemberOf('Generic Group Name')){
			return 'name!=Hidden Group';
		}else{
			return '';
		}
	},
	
	type: 'myGroupQuery'
};