How to make an already created custom table extend another custom table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2015 01:39 AM
How to make an already created custom table extend another custom table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2015 02:00 AM
Here is a script to extend an existing table.
Important Notes
- Always test first in a test or development ServiceNow instance
- This script does work with tables with data in them, however I suggest only running this on new or empty tables.
- This is a manual step and isn't captured in an update set.
Steps to extend table
- Elevate your privileges to security admin
- 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);
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2015 02:11 AM
Hi,
I have been trying script it from many days. But I get this message when I run the script-> Hierarchy change for u_cpar ignored because new base table 'u_business_services' does not have (but needs) a sys_class_name field
we can extend inbuilt tables using this script, but not custom tables. Is there any other way which we can make this script work?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-15-2018 02:38 AM
It worked for me in Istanbul instance. Both my tables are newly created and then made one of the table as parent to another table. Good script. Thank you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎12-11-2015 02:33 AM
Hi Upasana,
1. Deactivate the business rule "Table Field Validation".
2. In the list View extend the custom table.
3. Finally activate the business rule "Table Field Validation".