How to change parent of a table?

Suresh Vemanna1
Kilo Contributor

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 changer = new Packages.com.glide.db.table.TableParentChange('u_load_balancer');
//var g = changer.change('cmdb_ci_netgear','cmdb_ci_server');  
//gs.print(g);
 
var changer = new GlideTableParentChange('cmdb_ci_lb');
var g = changer.change('cmdb_ci_server','cmdb_ci_netgear');
gs.print(g);
 
I have found reParentTable() method from CMBDUtil API in the ServiceNow docs. But even this returned "false".
var gr = SNC.CMDBUtil.reParentTable('cmdb_ci_lb', 'cmdb_ci_server', 'cmdb_ci_netgear');
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

10 REPLIES 10

shyamakavaram
ServiceNow Employee
ServiceNow Employee

While running through background scripts you should uncheck 'record for rollback' else it will fail. This is expected behavior for reparenting.

This was the solution for me. Thank you!

This is the correct answer to the original question.


The opinions expressed here are the opinions of the author, and are not endorsed by ServiceNow or any other employer, company, or entity.

Looks like this is now supported only on custom tables.  If you run this on standard CI tables, you will get the following error.

Abandoning re-parenting of non-customer table outside of upgrade/plugin: cmdb_ci_security onto cmdb_ci_netgear

The opinions expressed here are the opinions of the author, and are not endorsed by ServiceNow or any other employer, company, or entity.

I made the terrible mistake of developing a new application that required approvals but didn't realise until too late that I needed to extend task. Hooray for this solution which worked a treat.

Thank you.