TableUtils() utility additional functions
In my previous Return list of table extensions using TableUtils() utility article, I had covered a few interesting extension functions from TableUtils() utility. In this article, I will cover additional functions (Few are extreme cautious
)
Alright, Let's jump into it
isBaseClass() : Returns true if the given class has no parents and has extensions.
var isBase = new TableUtils('cmdb').isBaseClass();
gs.print(isBase);
isSoloClass() : Returns true if the given class has no parents and no extensions
var isSolo = new TableUtils('sys_user_group').isSoloClass();
gs.print(isSolo);
hasExtensions() : Returns true if the given table has extensions
var hasExt = new TableUtils('cmdb_ci_server').hasExtensions();
gs.print(hasExt);
getAbsoluteBase(): Returns the root class of the table
var getBase = new TableUtils('cmdb_ci_server').getAbsoluteBase();
gs.print(getBase);
Note: Kindly, use the below functions with extreme caution
drop() : Drops the database table and its data eternally
var dropTable = new TableUtils().drop('u_from_scratch');
dropAndClean() : Drops the database table and cleans up the references to the table
var dropCleanTable = new TableUtils().dropAndClean('u_sample_table');
dropTableAndExtensions() : Drops the database table, all of its extended tables and cleans up references to the table
var dropTableExtensions = new TableUtils().dropAndClean('u_table');
I hope you like my article ![]()
Kindly, Post comments if any corrections are required
Regards,
Sai Kumar
https://www.servicenow.com/community/developer-articles/tableutils-utility-additional-functions/ta-p/2312768