- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2017 04:59 AM
Within a script include I'd like to determine the field type of certain fields and, if the type is reference, which table it references.
I don't have any issues with determining the field type and can successfully determine whether a field is a reference field or not using element descriptor and getInternalType().
However, I'm not sure of the best way to determine which table the field references.
Currently, my only idea is to glide the sys_dictionary table to find the field and hence which table it references but I'm sure there must be a function somewhere that gets this in a more elegant way?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎05-03-2017 05:04 AM
Hi Liv,
You can use the function getReferenceTable() of the GlideElement, see the documentation: getReferenceTable()
var grINC = new GlideRecord('incident');
grINC.query('number','INC0010041'); // record assignment group assigned to "CAB Approval"
if (grINC.next()) {
// Get the table name
var tableName = grINC.assignment_group.getReferenceTable();
gs.info( tableName );
}
Please Hit like, Helpful or Correct depending on the impact of the response
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-10-2020 01:17 PM
Thank you for sharing this method on glide_list field.
Do you still have the source where you found it?