How to access parent object within "query from" of relationship
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-06-2018 12:34 PM
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?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
09-01-2022 06:50 AM
I am pulling out my hair trying to get "Apply To" to work. I keep getting an error: ReferenceError: "table_name" is not defined.
Have you tried this recently?
I get this error with something as simple as:
answer = ('cmdb_ci' == table_name);
The only way I get this to work is either:
1. set "Applies To Table" to a table
or
2. set "Apply To" to:
answer = true;