How to change parent of a table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2019 01:50 AM
Hello Experts,
I am trying to change the parent table of one table.
I have gone through few posts on community and found the below methods which can change the parent of a table. But it is always returning 'false' for me.
var g = changer.change('cmdb_ci_server','cmdb_ci_netgear');
gs.print(g);
gs.print(gr);
I tried the same even for my custom tables, which I made sure that the tables are extensible. But still it didn't work.
I have elevated roles to 'security_admin' and tried, even this didn't work.
Has anyone tried changing the parent of a table?
Please note I do not want to create a new table to extend from the parent table I desire.
Please let me know the correct way to change the parent of a table.
Many thanks in advance.
Br,
Suresh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2019 01:54 AM
Hi Suresh,
can you try to do this and it should work; use the new keyword
var gr = new SNC.CMDBUtil.reParentTable('cmdb_ci_lb', 'cmdb_ci_server', 'cmdb_ci_netgear');
gs.print(gr);
Mark Correct if this solves your issue and also mark Helpful if you find my response worthy based on the impact.
Thanks
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2019 02:18 AM
Ankur,
Thanks for your response.
reParentTable() is a static method of CMDBUtil API, so it has to be called as 'SNC.CMDBUtil.reParentTable('cmdb_ci_lb', 'cmdb_ci_server', 'cmdb_ci_netgear');'.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎06-06-2019 02:13 AM
there is a workaround for this.
if you want you can try on custom table and validate if this is working fine or not.
There is OOTB business ("Table Field Validation") rule which prevent the edit on "Extends table" field after creation of table.
you can disable this business rule for few minutes and then run the below code in background script .
var gr = new GlideRecord('sys_db_object');
gr.get('f8526f9adb753340e4d95740cf96192a'); //which table you want to make changes
gr.super_class='c22fbc47db222300e4d95740cf961938'; // set the table which you want to set
gr.update();
Note: This is just a workaround. Once you run the above code then mark the active true on "Table Field Validation" business rule.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-12-2021 11:48 AM
We are encountering the same problem here. All suggestions mentioned above are not working. Maybe those solutions are already out of date. Hope someone can help and update the solution. Thanks!