How to Set Reference Table as Dynamic based on some field data

subbu bugorg
Giga Contributor

Hi,

 

I see it is possible to filter out results returned by a reference qualifier based on some criteria. This is like we set Reference field looking up table "X" which has 10 records and creating a script include which returns query that returns only some of them.

 

My question is about dynamically creating a reference to table X, where X comes from another reference field that references sys_db_object.


Ex : User looks up a table from a reference field, say sys_processor, now another field should show records in sys_processor, but this is not a fixed table. Any idea how can I achieve this?

 

7 REPLIES 7

RaghavSh
Kilo Patron

Use below syntax:

javascript: new SI().func_name(current.field_name); // here you can pass the reference field value which refers "sys_db_object" and you can then get it in your script include function and do your operations.


Please mark the answer correct/helpful accordingly.

 


Raghav
MVP 2023

Say for
field "A" -  Type =>Reference, Reference="sys_db_object"

"B" - Type=>Reference,  you are asking to write a ref qualifier with script include name, but what reference type should I use while creating this field? Since my table actually depends on column A result, but I cannot add a column without specifying reference table name.

Also even if i get the ref table name from previous field in script include, I guess the return value is evaluated as query, so how can I return list of elements to show based on this name. 

Then it cannot be a reference type because you need table first. In that case you can create a string type field (B) and populate it on change of your field A, using on change client script.


Raghav
MVP 2023

If I have field B as string and populate the value on change of field A, it would just be the name of table in field B. What I want B to contain is, a record on table chosen in A.