How to access parent object within "query from" of relationship

Subhrajit2
Giga Contributor

I am trying to create a scripted defined related list on a table which will display records from different archive tables based on a field value on the parent table. I am doing something like this.

 

Apply to: a particular table
sample statement: answer = "target_table";

Query from: Scripted
Sample statement:

var table = "ar_" + parent.u_select_table.toString();//u_select_table is a field on the "target_table" which contains a table name
answer = new TableUtils(table).tableExists() == true?table:false;

 

What I am suspecting is that the parent object is not accessible within "Query from" script. So, is there a way I can populate the "query from" table dynamically based on current parent record's field value?