logo

NJP

44. Undocumented: Table Extension APIs

Import · May 27, 2024 · article

There are many undocumented ServiceNow APIs that have existed since the beginning. These are a couple that you may come across needing either as a system administrator or developer.

The first is the GlideTableParentChange if you need to move a table to be extended from another table. An example use case is that you may have accidently created it under the wrong table, like the wrong CI or task table.

var table = ‘’; //table you want to extend var old_parent = ‘’;

var new_parent = ‘’; //the table you want to extend to, like cmdb_ci or task

var changer = new GlideTableParentChange(table);

changer.change(old_parent, new_parent);

The second is GlideDBUtil.promoteColumn which is a single one line script that lets you move a column up to the parent level table. This also might be useful in CMDB management, where you may have created a column under a table, but it really need to be moved to the parent so more CIs can use the field.

GlideDBUtil.promoteColumn(‘table_to_move_from’, ‘table_to_move_to’, ‘field_to_move’, true);

Note: This scripts only work in Global Application scope

View original source

https://medium.com/@LearnITbyPrashant/45-undocumented-table-extension-apis-252a3874fb3a?source=rss-d005fc598f0a------2