reference user

zx
Tera Contributor
I created a table field reference on the user table. When adding it to the screen, I want this field to only select users from a fixed group. How should I implement this?
1 ACCEPTED SOLUTION

Najmuddin Mohd
Mega Sage

Hi @zx ,

On the created field, Configure dictionary and Select the Advance View.
From the reference specification, select 'Advanced' in User reference qualifier, and call the script include.

NajmuddinMohd_0-1724654516350.png


Script include:
Name: getUsers

Client callable: true

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

	getGroup : function(){

		var array = [];

		var grGroupMember = new GlideRecord('sys_user_grmember');
		grGroupMember.addEncodedQuery('group=c38f00f4530360100999ddeeff7b1298'); // Add the sys_id of the group
		grGroupMember.query();

		while(grGroupMember.next()){
			array.push(grGroupMember.user.toString());
		}

		return 'sys_idIN' + array;
	},


    type: 'getUsers'
});

 

If this information helps you, Kindly mark it as Helpful and accept the solution.

Regards,
Najmuddin.

View solution in original post

1 REPLY 1

Najmuddin Mohd
Mega Sage

Hi @zx ,

On the created field, Configure dictionary and Select the Advance View.
From the reference specification, select 'Advanced' in User reference qualifier, and call the script include.

NajmuddinMohd_0-1724654516350.png


Script include:
Name: getUsers

Client callable: true

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

	getGroup : function(){

		var array = [];

		var grGroupMember = new GlideRecord('sys_user_grmember');
		grGroupMember.addEncodedQuery('group=c38f00f4530360100999ddeeff7b1298'); // Add the sys_id of the group
		grGroupMember.query();

		while(grGroupMember.next()){
			array.push(grGroupMember.user.toString());
		}

		return 'sys_idIN' + array;
	},


    type: 'getUsers'
});

 

If this information helps you, Kindly mark it as Helpful and accept the solution.

Regards,
Najmuddin.