
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2022 12:40 AM
Hello community!
I've got a custom table with a reference to Table (sys_db_object) and a reference to Field (sys_dictionary).
The reference to Field (sys_dictionary) has a ref. qualifier like:
javascript:"active=true^name="+current.u_table.name.getValue()
It works fine for fields belonging directly to the table but it fails when the table is a child table and filter does not return the fields belonging to parent table.
Does anyone know how can I apply a ref. qualifier fetching all the fields?
Thanks in advance!
Cheers,
Alex
Solved! Go to Solution.
- Labels:
-
Multiple Versions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2022 06:49 AM
Solution:
Array(new TableUtils(current.u_table.name.getValue()).getHierarchy()).toString().replace("[", "").replace("]", "");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2022 12:45 AM
Hi
you can use the TableUtils API to fetch all parent tables in a list: https://developer.servicenow.com/dev.do#!/reference/api/sandiego/server_legacy/c_TableUtilsAPI#r_TU-...
And build a ref qualifier like this
javascript:"active=true^nameIN" + new TableUtils(current.u_table.name.getValue()).getHierarchy()
Kind regards
Maik

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-22-2022 03:53 AM
Hey Mike!
Thanks for your answer. It looks like not working because of the type of data returned by the method .getHierarchy()
.
It returns something like "[table_a, table_B]"
but query would work with something like ["table_a", "table_b"]
. Do you know any solution for it?
Cheers,
Alex

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-24-2022 06:49 AM
Solution:
Array(new TableUtils(current.u_table.name.getValue()).getHierarchy()).toString().replace("[", "").replace("]", "");
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-25-2022 08:31 AM
Hi
just remembered the problem with returned java objects instead javascript objects
So the best and recommended approach is using j2js.
The example for exact your situation is given at https://developer.servicenow.com/dev.do#!/reference/api/quebec/server_legacy/r_J2js-j2js_O
That way, there is no need for string replacements.
Kind regards
Maik