ref qualifier

tushar_ghadage
Tera Contributor

hi all , 

there are two fields 

1.assignment group 

2.caller 

 

when i select assign group caller will get populated with group members only

so here i created dynamic reference qualifier and called script include there below is the picture of what i did :

Screenshot (5).png

Screenshot (6).png

Screenshot (7).png

but on the form its not working it is showing me all the users which ever group is select.

 

1 ACCEPTED SOLUTION

Ankur Bawiskar
Tera Patron
Tera Patron

@tushar_ghadage 

simply use this in advanced ref qualifier

javascript: new GroupMembers().getgroupmembers(current.variables.variableName);

inside the script include accept this parameter and comment line 6

getgroupmembers: function(groupusers)

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

3 REPLIES 3

Dr Atul G- LNG
Tera Patron
Tera Patron

Hi @tushar_ghadage 

 

What will happen if there more than 1 member in the group?  Which user it should populate.

*************************************************************************************************************
If my response proves useful, please indicate its helpfulness by selecting " Accept as Solution" and " Helpful." This action benefits both the community and me.

Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/atul_grover_lng [ Connect for 1-1 Session]

****************************************************************************************************************

_Gaurav
Kilo Sage

Hi @tushar_ghadage 
In this case, you can use a reference qualifier on the caller field:

javascript: new youscriptincludename().methodname(current.assignment_group);

and write the below code in the script include

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

Please mark this as solution and helpful if this resolves your query.
Thanks

Ankur Bawiskar
Tera Patron
Tera Patron

@tushar_ghadage 

simply use this in advanced ref qualifier

javascript: new GroupMembers().getgroupmembers(current.variables.variableName);

inside the script include accept this parameter and comment line 6

getgroupmembers: function(groupusers)

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