Extend an existing table

If you created a new table, added a lot fields, and then realized it wasn't extended off a table you need like the task or cmdb_ci table, it can be a big process to delete the table and start over.

Here is a script to extend an existing table.

Important Notes

  1. Always test first in a test or development ServiceNow instance

  2. This script does work with tables with data in them, however I suggest only running this on new or empty tables.

  3. This is a manual step and isn't captured in an update set.

Steps to extend table

  1. Elevate your privileges to security admin

  2. In scripts - background run this script (replacing variables as needed)

//Replace <source_table> with the table you want to extend
//Replace <table_extension> with the table you want to extend to, like cmdb_ci or task
var table = '<source_table>';
var old_parent = ''; 
var new_parent = '<table_extension>'; 

var changer = new GlideTableParentChange(table);
changer.change(old_parent, new_parent);