How to pass a list value to another list in UI Policy

ryo200
Tera Contributor

Hi,

Reference the record name of table 1 in table 2's form. I want to use it to query and add the values from the list in table 1 to the list in table 2.
but i can't do this.
Is-he possible to do this ?

 

Tabale1
name:table1_list_name Type:string
name:table1_list Type:list Reference:sys_user

 

Table2
name:table1_list_name2 Type:string
name:table2_list Type:list Reference:sys_user

 

UIPoricy
Conditon
tabale1_list_name2 is not null.

True
function onCondition() {
var userList = new GlideRecord('table1');
var user_array = [];
userList.addQuery('table1_list_name','=',current.table1_list_name2);
userList.query();
user_array.push(userList.table1_list.toSting());
current.table2list = user_array;
}

False
function onCondition() {
var user_array = [];
current.tabele2_list = user_array;
}


Thank you.

6 REPLIES 6

ryo200
Tera Contributor

Entering script include seems to cause errors in function and return.

I have made the following changes, but they do not work properly.


-----script include--------

var getUserDetails = function() {
var id = this.getParameter('sysparm_userID');
var grUser = new GlideRecord('sys_user');
grUser.addQuery('sys_id', id);
grUser.query();

var usrobj = {};
while (grUser.next()) {
usrobj.email = grUser.name.toString();
}
return JSON.stringify(usrobj);
};

ryo200
Tera Contributor

Thank you very much for your answer.
Thank you all.

I found the solution in another post and am attaching it here.

 

https://www.servicenow.com/community/%E9%96%8B%E7%99%BA%E8%80%85%E3%83%95%E3%82%A9%E3%83%BC%E3%83%A9...