官术网_书友最值得收藏!

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:

主站蜘蛛池模板: 开原市| 静海县| 北票市| 六安市| 德清县| 上饶县| 鹰潭市| 安义县| 巴林左旗| 五峰| 淮北市| 灵台县| 罗江县| 铜山县| 昌都县| 如东县| 澄迈县| 黑水县| 阜宁县| 新安县| 建水县| 安达市| 郯城县| 股票| 济宁市| 遂平县| 成都市| 林芝县| 灵台县| 华亭县| 兴海县| 时尚| 勐海县| 洪雅县| 安龙县| 湘潭市| 呼和浩特市| 富顺县| 甘南县| 化德县| 庆云县|