Table Hierarchy In ServiceNow: Complete Guide
GlideTable Hierarchy is a ServiceNow Server scoped API which provides information about the Table hierarchy and relationships. We have TableUtils API which can be used to retrieve the hierarchy of tables in ServiceNow.
TableUtils is limited to the global scope in ServiceNow and it cannot be accessed from scoped application. So there is either of ways to achieve this solution:
- Copy TableUtils inside the scoped application.
- writing logic for GlideRecord the “sys_db_object” table.
This solution implementation might take some additional effort for a developer. So here TableHierarchy API can be very useful to bring our efforts down and easy in implementation. To get the hierarchy of any table in scoped applications. The below methods will be useful.
Method Summary:
In this Blog, We will drive through a few methods of this API with reference to the CMDB table hierarchy. For that we can use this API as follows:
API Definition: getTableExtensions() returns an array containing the table names that extend the current table.
Note: Current table will not be part of the return object. If you want to include the current table in the return object use getAllExtensions() method.
To fetch all the child tables(hierarchy) for the cmdb_ci_computer table. We can use this method as explained below in the example.
Output:Output:
cmdb_ci_computer, cmdb_ci_hardware, cmdb_ci, cmdb, cmdb_ci_ucs_blade, cmdb_ci_server, cmdb_ci_osx_server, cmdb_ci_mainframe, cmdb_ci_datapower_server, cmdb_ci_lb, cmdb_ci_lb_bigip, cmdb_ci_lb_a10, cmdb_ci_lb_cisco_csm, cmdb_ci_lb_alteon, cmdb_ci_lb_f5_gtm, cmdb_ci_lb_cisco_gss, cmdb_ci_lb_isa, cmdb_ci_lb_cisco_css, cmdb_ci_lb_ace, cmdb_ci_lb_radware, cmdb_ci_lb_network, cmdb_ci_lb_netscaler, cmdb_ci_lb_f5_ltm, cmdb_ci_ibm_zos_server, cmdb_ci_virtualization_server, cmdb_ci_vcenter_server_obj, cmdb_ci_esx_server, cmdb_ci_hyper_v_server, cmdb_ci_storage_server, cmdb_ci_win_server, cmdb_ci_linux_server, cmdb_ci_storage_node_element, cmdb_ci_isam_server, cmdb_ci_mainframe_lpar, cmdb_ci_server_hardware, cmdb_ci_tape_server, cmdb_ci_net_app_server, cmdb_ci_chassis_server, cmdb_ci_netware_server, cmdb_ci_unix_server, cmdb_ci_aix_server, cmdb_ci_solaris_server, cmdb_ci_hpux_server, cmdb_ci_cim_server, cmdb_ci_storage_switch, cmdb_ci_mainframe_hardware, cmdb_ci_pc_hardware, cmdb_ci_ucs_rack_unit
API Definition: getRoot() returns the top-level class in the hierarchy.
For Global, a Similar method is getAbsoluteBase() which returns the base table name from which the table was extended.
Note: For any table under the cmdb_ci hierarchy, this method returns cmdb_ci and not CMDB, which is the actual base table.
Output:
cmdb
API Definition: getBase() returns the parent class which current class is extending like task(return) for incident(argument).
Output:
Cmdb_ci_hardware
If you want to increase the quality and efficiency of your ServiceNow workflows, Try out our ServiceNow Microassesment.
For ServiceNow Implementations and ServiceNow Consulting Visit our website: https://aelumconsulting.com/servicenow/
Comments
Post a Comment