TableUtils not working in script include

dhathrianoop
Giga Expert

I have included TableUtils in script include (not working)..however it worked when  I ran in background script



var tu = new global.TableUtils(sysClass);
var classHierarchy = tu.getTables().toArray();
ciClassH=classHierarchy.join(':');


var ciParentTable=['cmdb_ci_hardware','cmdb_ci_appl','cmdb_ci','cmdb_ci_netgear','cmdb_ci_server'];
var hierarchyName=['Hardware Hierarchy','Application Instance Hierarchy','Independent Hierarchy','Network Hierarchy','Server Hierarchy'];
for(var x=0;x<classHierarchy.length;x++)
{
var arrayUtil = new ArrayUtil();
if(arrayUtil.indexOf(ciParentTable, classHierarchy[x])>-1)
{
TableHierarchy=
hierarchyName[arrayUtil.indexOf(ciParentTable,classHierarchy[x])];
break;
}
}
tableHierarchy=TableHierarchy;

13 REPLIES 13

What are you passing in sysClass?


Please mark this response as correct or helpful if it assisted you with your question.

class names..like cmdb_ci_appl

Hm, I just pasted the script in earlier comment into my instance, substituted sysClass with 'cmdb_ci_appl' and added gs.print(tableHierarchy) to the end. It printed the expected 'Application Instance Hierarchy'. Are you sure your TableUtils script include hasn't been customized?

chidanandadhath
Kilo Guru

I'm writing this script for a scoped app...