If assignment Group is empty then 'Assigned to' Reference Table doesn't show any user

Vartika Goel
Tera Contributor

Hi Team,

On the INC form i want 'assigned to' field pop-up table doesn't show any user until we have 'assignment group' filled. I want to achieve this via Advance reference qual calling script include function. 

 

VartikaGoel_0-1679641892210.png

If above assignment group is empty it should not show users in 'assigned to' field pop table as below:

VartikaGoel_1-1679641944162.png

 

 

Thanks in Advance

1 ACCEPTED SOLUTION

kotharir
Tera Expert

Hi @Vartika Goel .

Follow below steps

1. Create script include and write below code.

var getUser = Class.create();
getUser.prototype = {
initialize: function() {},
getsys: function(group_Name) {

var arr = [];
var grSUG = new GlideRecord('sys_user_grmember');
grSUG.addEncodedQuery("group.sys_id=" + group_Name);
grSUG.query();
while (grSUG.next()) {
arr.push(grSUG.user.toString());
}
return 'sys_idIN' + arr.toString();

},

type: 'getUser'
};

2. Right click on "Assigned to" field and open dictionary override and search for incident table and make following changes.

enable the checkbox and make dependent field empty.

Override dependent

Make sure the check box enabled "Override reference qualifier" and write the code "javascript:new global.getUser().getsys(current.assignment_group);" under "Reference Qualifier" field. 

Please change script include and function name as per the naming standard.
and write the code under "reference qualifier".

 

Please mark the answer correct if it helps.

 

View solution in original post

11 REPLIES 11

kalyani8
Giga Expert

Hello Vertika Goel,

 

You can follow  below steps:

1. create a script include and call it in the reference qualifier of 'assigned to' field

2. pass assignmnet group in the qualifier parameter

3. return group members sys_id's as a response from script include (use 'sys_user_grmember' to get the members of a group).

 

Try above steps and let me know if that works.

 

 

 

Gopi Naik1
Kilo Sage

Hi @Vartika Goel,

 

Create a client callable script include as follows:

var GetGroupMembers = Class.create();
GetGroupMembers.prototype = Object.extendsObject(AbstractAjaxProcessor, {
getUsers:function(groupId){
var userSysId=[];
var grmem=new GlideRecord('sys_user_grmember');
grmem.addQery('group',groupId);
grmem.query();
while(grmem.next()){
userSysId.push(grmem.getValue('user');
}
return 'sys_idIN'+userSysId.toString();
},
type: 'GetGroupMembers'
});

 

And Call the script include from advanced reference qualifier of assigned to field as javascript: new GetGroupMembers().getUsers(current.assignment_group);

 

Thanks,

Gopi

 

If my solutions helps you to resolve the issue, Please accept solution and Hit "Helpful".

Thanks,
Gopi

Hi @Gopi Naik1 

 

Thank you for reply 
getting below error:

VartikaGoel_0-1679644629119.png

 

Hi @Vartika Goel ,

 

Please add " type: 'GetGroupMembers'" after 14th line.

 

Thanks,

Gopi

If my solutions helps you to resolve the issue, Please accept solution and Hit "Helpful".

Thanks,
Gopi