Field to reference qualifier from 2 tables

Max Lin
Tera Contributor

I have 2 fields and both of them are stored in different table

Assignment Group  (sys_user_group table)
Assigned Group's Assessor (u_assessor table).

I can pull related list out from the group view. see below screenshot. 

find_real_file.png

u_assessor list view:
find_real_file.png

However, i cant seems to make the field Assigned Group's Assessor. 

Field: 
find_real_file.png

 

I think it's related to this reference qualifier. I can't seems to figure out.. What should the javascript...
find_real_file.png

 

Thanks all!

1 ACCEPTED SOLUTION

Hi,

But your field is referring to sys_user table

you would require scripting with advanced ref qualifier

1) pass the group

2) query assessor table with this group and push all the users into array

3) return those users

Advanced ref qualifier

javascript:getUsers(current.assignment_group);

Script Include:

function getUsers(group){

	var arr = [];
	var gr = new GlideRecord("u_assessor");
	gr.addQuery("u_group", group);
	gr.query();
	while(gr.next()) {
		arr.push(gr.getValue('u_user'));
	}
	return 'sys_idIN' + arr.toString();
}

find_real_file.png

Regards
Ankur

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

View solution in original post

5 REPLIES 5

THANK YOU ANKUR! It's WORKING. YOU'RE THE GUY!