Shamma Negi
Kilo Sage

Hi All,

 

Today I would be covering the list of parent tables for the table given below:

 

GlideRecordUtil - getTables(String tableName)

Returns a Java ArrayList of the ancestors of the specified table name.

 

For example, given cmdb_ci_linux_server, this would return cmdb_ci_linux_server, cmdb_ci_server, cmdb_ci_computer, cmdb_ci_hardware, cmdb_ci, and cmdbr.

 

ParametersName Type Description
tableNameStringName of the table.

 

 

ReturnsType Description
ArrayListList of ancestors of the specified table.

 

Example

The following example shows the ancestors of the cmdb_ci_linux_server table.

 

 

var tables = new GlideRecordUtil().getTables("cmdb_ci_linux_server");
gs.info("Tables returned: " + tables);

 

 

Output:

 

 

Tables returned: [cmdb_ci_linux_server, cmdb_ci_server, cmdb_ci_computer, cmdb_ci_hardware, cmdb_ci, cmdb]

 

 
Another Example:
 
Inputs
var tables = new GlideRecordUtil().getTables("incident");
gs.info("Tables returned: " + tables);
 
Outputs:
 
 
Hope this helps you.
I hope this article helpful. Please mark it as helpful and bookmark if you like it.
 
Regards,
Shamma Negi
2 Comments