What is best practice for creating a custom table vs creating custom table by extending a base table?

ty_roach
Tera Guru

It appears that "Extending a base table" does not copy the base tables fields into a new table, but literally extends (as in java class extends). note - I think the wiki is misleading for creating a custom table in section 3.1 it suggests extending a table if you are trying to re-use some existing tables characteristics for your new table "To create a table for tasks, similar to the Incident, Problem, or Change tables, follow the above steps and extend the base table Task"

[done venting]

I discovered this was the case because I created a custom table by extending the change_request table (since it had some of the fields that I was interested in). Next, I changed the "Short Description" label using the personalize dictionary option and seemed to change the label beyond just that form. It was then that I noticed that this label change could be seen in the change_request table (that's when I realized that my custom table is sharing the contents of its parent table - change_request), but could also be seen in other tables (portfolio and some reports).

So....I guess I'm looking for thoughts as to when it makes sense to create a custom table with only those fields that you want in it vs extending a base table. Thoughts???

To put it in context to what we are doing, we are trying to create a collaboration area for a couple of working groups. We created a choice field to hold the various working group names, and a journal field so we could see the history of comments by various people. We would show the priority, short description, number and a description field. So I thought, "lets just use the change_request table and extend it" - thinking it would create a copy of change_request, inheriting all the fields, etc, from that table and I could extend my new table as I wanted without it affecting the change_request. I knew I wanted to change labels (like change "Description" to be "Requirement Description", change "Short Description" to be "Requirement").

3 REPLIES 3

adiddigi
Tera Guru

Hi,

Firstly WIKI when it says if you want to extend some of the functionality of the Base time extend it is exactly what happens.

Lets take your example of change_request,From a process point of view, supposing you had a requirement called you need to have a table called maintenance which is another Change to the system. Now if you extend the change_request, you will get all the characteristics of it, like change_number and its business rules as well like change events which will fire events to CAB/change manager when ever a maintenance is inserted/reviewed so on.

Now if you create a new table without extending the base table, you will have to code all this business rules again.


This is just an example. There are many other "functionalities" that the extended table extends.There are lot many other things I can think off, But its already pretty late here 🙂
[Quote]
Next, I changed the "Short Description" label using the personalize dictionary option and seemed to change the label beyond just that form. It was then that I noticed that this label change could be seen in the change_request table
[/quote]

Now when you change the Short Description on your custom extended table, its the real Parent's(Change_request's) parent you are changing. You will have to use Dictionary overrides to specifically use it to your extended table.

You might want to look at this link for you query
http://wiki.service-now.com/index.php?title=Dictionary_Overrides


CapaJC
ServiceNow Employee
ServiceNow Employee

I'll leave it to others to go more deeply into pros and cons (I've not had any implementation experience), but I think you were right to extend in this case. Different extension tables can have different labels for the field from the base table field. From the wiki:

"If a field is on a base table, like task, a different label can be defined for each extended table, like incident or problem. To add a different label for an extended table, Navigate to System Definition > Language File, and create a new entry for the extended table. Table is the extended table name, like incident or problem, and Element is the field name."

And different extension tables can likewise have different sets of choices for a Choice List field from the base table.


ty_roach
Tera Guru

Entering a new entry into the Language File work! I now have a better understanding of what that is and how to use it. Thank you all SO much!