Concept of Inheritance in Service-now
Assignment 1- Concept of Inheritance in tables
- Parent_table
- Child_table 1
- Child_table 2
While creating Parent_table, check the box : Enable extension under control section in the create table window.
Create fields in Parent_table as:
- P_first_name
- P_last_name
- P_phone_no
Create Child_table 1 by extending Parent_table as shown in the screenshot below.
In Child_table 1, create fields as:
- C1_first_name
- C1_last_name
- C1_phone_no
Similarly create table Child_table2 extending Parent_table.
While creating fields in both Child_table 1 and Child_Table 2, it is seen that fields present in Parent_table is present in the 2 child tables.
So the fields created in parent table reflects across all it’s child tables.
In Child_table2,create fields as:
- C2_first_name
- C2_last_name
- C2_phone_no
Now , the relationship is created in such a way that Parent_table is the parent of both Child_table 1 and Child_table 2.
This can be verified by searching for the parent table in the navigation bar
Then click on Show Schema Map.
The Schema for Parent_table is shown below:
Create new records in all 3 tables and observe the records that are reflected between parent/child table.
Step1:
In the above2 screenshots, we can see that records added in Parent table are not seen in the Child_table 1 .The same is true with Child_table 2 also.
Step 2:
A new record in Child_table 1 is created in the above screenshot.
When the Parent_table is checked, it is seen that the record created in Child_Table 1 is visible. So the data/ records in child table is reflected in parent table as well.
Step 3:
A new Record is created in Child_table2
It is observed that the new record from Child_table 2 is visible in Parent_table also.
It is finally seen that the fields are reflected from parent to child table, but the data/records are not.
Also the data/records created in child table reflect in parent table but not the fields alone
In summary,
Fields/customization flows downwards and data/records flow upwards in Parent-Child Relationship.
Concept of Inheritance in tables
When inheritance is established between two tables, the customization flows from parent table to the child table but the records/data flows from the child table to the parent table.
Example: If two tables A and B are created such that B is a child of table A, then the fields created in table A are reflected in table B but records created in table A are not reflected in B.On the other hand, the records created in table B are reflected in it’s parent Table (A) but not the fields.
While creating a UI Policy for a particular table, the same UI policy can be applied to it’s child table as well. This can be done by checking the ‘inherit’ checkbox while creating the UI Policy for that table.
