
Database table inheritance
When tables share more than a few of the same fields, it is quite often beneficial to extend other tables. Indeed, there are a few tables in ServiceNow which are meant only to be extended, and never to have records created on themselves. The Task [task] table is a prime example that we already have some familiarity with. We'll go into some detail on the task table in particular in a later chapter, but we'll use it as an example here just to touch on the topic of inheritance.
When one table extends another table, the child table inherits any fields on the parent table. All inherited fields are on the child table, and do not need to be dot-walked to, to be accessed. This has innumerable benefits, such as being able to search for a record on a base table, and discover records in all child-tables. Again, using the task table as an example, you might want to see all work assigned to you. The task table is generally where work records are stored (incident tickets, requests, problems, changes, and so on), so you can just run one filter on the task table to show records where Assigned to [assigned_to] is your user account, and you'll see any records in all of the child tables where that condition is true. This is possible, because the Assigned to field is actually on the base/parent task table.
You can include extended (child) table fields in base (parent) table lists by enable a system property: glide.ui.list.allow_extended_fields from the sys_properties list.
Whenever you create a new table, it's a good idea to ask yourself: Are there other tables that do something similar? Do I need to create/use more than one or two fields that already exist on another table? Is there some functionality linked with a base system table (such as task) that would be useful for my new table? If so, you should carefully consider the option of extending an existing table, rather than creating one from scratch.
You can see a visual representation of all of the existing tables in your instance, and their reference-relationships to one another, by navigating to System Definition | Tables & Columns, selecting a table to center on (such as Task [task], and clicking Schema map. In this view, you can visit a table's dictionary, focus the view on a given table by right-clicking it, or go to the table's list: