GlideTableHierarchy - Scoped

The Scoped GlideTableHierarchy API provides methods for handling information about table relationships.

Scoped GlideTableHierarchy - getAllExtensions()

Returns an array of strings containing all tables that extend the current table and includes the current table.

Table 1. Parameters
Name Type Description
None
Table 2. Returns
Type Description
Array An array of strings containing the tables in the hierarchy that includes the current table.
var table = new GlideTableHierarchy("task"); 
gs.info(table.getAllExtensions());

Output: Line breaks added for clarity.

task,sc_task,problem_task,change_phase,sc_req_item,kb_submission,
release_phase,problem,ticket,sm_task,hr_task,change_task,change_request,
change_request_imac,incident,release_task,vtb_task,sm_order,hr_case,
sysapproval_group,sc_request

Scoped GlideTableHierarchy - getBase()

Returns the parent class.

Table 3. Parameters
Name Type Description
None
Table 4. Returns
Type Description
String The parent class.
var table = new GlideTableHierarchy("cmdb_ci_server"); 
gs.info(table.getBase());
Output:
cmdb_ci_computer

Scoped GlideTableHierarchy - getHierarchy()

Returns an array of strings containing all classes in the hierarchy of the current table.

Table 5. Parameters
Name Type Description
none
Table 6. Returns
Type Description
Array An array of strings of the classes in the hierarchy.
var table = new GlideTableHierarchy("incident"); 
gs.info(table.getHierarchy());
Output:
incident,task

Scoped GlideTableHierarchy - getName()

Returns the table's name.

Table 7. Parameters
Name Type Description
None
Table 8. Returns
Type Description
String The table's name.
var table = new GlideTableHierarchy("incident"); 
gs.info(table.getName());
Output:
incident

Scoped GlideTableHierarchy - getRoot()

Returns the top level class in the hierarchy.

Table 9. Parameters
Name Type Description
None
Table 10. Returns
Type Description
String The root class.
var table = new GlideTableHierarchy("cmdb_ci_server"); 
gs.info(table.getRoot());
Output:
cmdb_ci

Scoped GlideTableHierarchy - getTableExtensions()

Returns an array of strings containing all tables that extend the current table.

Table 11. Parameters
Name Type Description
None
Table 12. Returns
Type Description
Array An array of strings containing the tables that extend the current table.
var table = new GlideTableHierarchy("task"); 
gs.info(table.getTableExtensions());
Output: Line breaks added for clarity
sc_task,problem_task,change_phase,sc_req_item,kb_submission,release_phase,problem,
ticket,sm_task,hr_task,change_task,change_request,change_request_imac,incident,
release_task,vtb_task,sm_order,hr_case,sysapproval_group,sc_request

Scoped GlideTableHierarchy - getTables()

Returns an array of strings of the table names in the hierarchy.

Table 13. Parameters
Name Type Description
None
Table 14. Returns
Type Description
Array An array of strings containing the names of tables in the hierarchy.
var table = new GlideTableHierarchy("incident"); 
gs.info(table.getTables());
Output:
incident,task

Scoped GlideTableHierarchy - GlideTableHierarchy(String tableName)

Instantiates a GlideTableHierarchy object.

Table 15. Parameters
Name Type Description
tableName String The name of the table.
var table = new GlideTableHierarchy("incident"); 
gs.info(table.getTables());
Output:
incident,task

Scoped GlideTableHierarchy - isBaseClass()

Returns true if this is a base class.

Table 16. Parameters
Name Type Description
None
Table 17. Returns
Type Description
Boolean True if the current table has no parent and has extensions.
var table = new GlideTableHierarchy("incident"); 
gs.info(table.isBaseClass());
Output:
false

Scoped GlideTableHierarchy - isSoloClass()

Returns true if this table is not in a hierarchy.

Table 18. Parameters
Name Type Description
None
Table 19. Returns
Type Description
Boolean True if the current table has no parent and no extensions.
var table = new GlideTableHierarchy("sys_user"); 
gs.info(table.isSoloClass());
Output:
true

Scoped GlideTableHierarchy - hasExtensions()

Returns true of this class has been extended.

Table 20. Parameters
Name Type Description
None
Table 21. Returns
Type Description
Boolean True if the current table has extensions.
var table = new GlideTableHierarchy("incident"); 
gs.info(table.hasExtensions());
Output:
false