The CreatorCon Call for Content is officially open! Get started here.

ServiceNow clone table structure without extend / relationship / link?

jackps
Tera Contributor

Hello,

 

I need to create a test table for Test purpose before creating the actual application. For this test table will requires nearly all the fields from "task" table and data type as well. Additional field to this test table will be add later.

 

My question would be:
1. Is there a way to copy / clone the "Task" table fields and fields type to this new test table??

2. After the fields and data type be copied / cloned to the "test table", there will be no extend / link to any other tables. Can this be done with script / without script?

Thanks in Advance

 

JC

3 REPLIES 3

Bert_c1
Kilo Patron

Hi jackps,

 

Create a new table extended from task. the new child table will inherit the fields from task. and you can add fields to that child table as desired.

 

You create the new table in the UI, use the "System Definitions - Table" navigation menu item.

 

see:

 

https://docs.servicenow.com/search?q=Table%20extension%20and%20classes

jackps
Tera Contributor

Hi Bert,

 

Thanks for your reply.

To what I understand, If extend from task table, when a new record add to the task table, it will be shown in "test table". Also when add record to "test table", it will insert to Task table?
- I want the test table have no extend / link to any other tables after copy / clone all the fields and field types from task table.

 

Thanks

JC

Bert_c1
Kilo Patron

Hello Jackps,

 

You need to understand the database schema use by Servicenow. (how tables are created in the database).  See:

 

https://docs.servicenow.com/search?q=Table%20extension%20and%20classes

 

Task is TPH, and any child table of task is "flattened" on the task table in the database, there is the sys_class_name field that distinguishes child tables.  See:

 

https://docs.servicenow.com/bundle/utah-platform-administration/page/administer/platform-performance...

 

It sounds like you want you new table to be extended from task, so it includes the fields from task. your child table of task will behave just like all others: incident, change_request, problem, sc_request, ... So I don't understand your desire. But you can achieve that with the help of Servicenow Support.  they have a "tool" to convert a table from TPH to TPC, and break the link form task.  Or you can just create your new table, and then define the same fields that task has. That will be the recommendation from the Support team I believe.

 

You can try exporting the sys_dictionary and sys_documentation records for task. Then use a text editor to change the 'name' value from task to that of the new table (after creating it) in the xml files. Then importing the two files.

 

Good luck.