Related List Based on Record Producer Variable

machiavvelli
Tera Contributor

I need to create a related list where a field on one table contains the same value as a variable associated with a record on another table.  Is this even possible?

 

current.addQuery('first_name', parent.variables.first_name);

 

Should I perhaps run a GlideRecord query on all records on the table and return only records where the "first_name" variable is the same as current.first_name?

 

Thanks for any assistance you can provide.

1 REPLY 1

machiavvelli
Tera Contributor

Update: I have tried the following script, but it returns zero records:

 

(function refineQuery(current, parent) {

var sysidlist = "";
var gr = new GlideRecord('x_amtra_passenger_passenger_barring_nomination');
gr.addQuery('variables.subject_first_name', current.first_name);
gr.query();
while (gr.next()) {
sysidlist += gr.sys_id;
}
current.addQuery('sys_id', 'IN', sysidlist);

})(current, parent);