- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-15-2023 10:28 PM
Hi,
I have a small doubt in the behavior of the inherited fields in child table. When a table in extended , parent fields are inherited to child table. When we say so, does it mean the inherited fields are physically created in the child table or it is it just accessed through dot walking?. I have confusion in understanding the inheritance and dot walking functionalities. Please help me clear on these topics.
Thank you,
Manasa
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-16-2023 05:48 AM
Hi @manasa0590,
Let me try to clarify on the points you mentioned
When a table is extended in ServiceNow, only the new fields defined in the child table are physically created in the child table. The inherited fields from the parent table are not physically created in the child table, but are accessed through dot walking notation. This means that the inherited fields are still part of the parent table, but they can be accessed from the child table as if they were part of the child table. So, when you extend a parent table in ServiceNow, the child table will have its own physical fields plus the inherited fields from the parent table.
The inherited fields from the parent table are accessed in the child table through dot walking notation. This means that you can access the inherited fields using dot walking notation, like this: "child_table.parent_field". However, since the inherited fields are accessible in the child table just like any other field of the child table, you can also access them directly using their field names, like this: "child_table_field_name". But it is recommended to use dot walking notation to access inherited fields, as it makes the code more readable and easier to understand.
Regards,
Shravan
Shravan
Please mark this as helpful and correct answer, if this helps you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-15-2023 11:31 PM
Hi @manasa0590,
Dot walking | Inheritance | |
Definition | Dot walking is a mechanism that allows you to access fields from related records. | Inheritance is a mechanism that allows you to extend a table by adding new fields or modifying existing fields. |
Purpose | Dot walking is used to traverse relationships between tables and to access fields from parent or child records. | Inheritance is used to extend a table by adding new fields or modifying existing fields. |
Example | To access the Department field of the User record associated with an Incident record, you can use the dot walking syntax incident.caller_id.department. | To extend the Incident table by adding a new field called Priority, you can create a new table that extends the Incident table and add the Priority field to it. The child table inherits all the fields and functionality of the parent table. |
Physical creation | Dot walking does not physically create new fields in a table. Instead, it provides a way to access existing fields from related records. | Inheritance does not physically create new fields in the child table. Instead, it provides a way to access fields and functionality from the parent table. |
Use with inheritance | Dot walking is often used in conjunction with inheritance to access fields from the parent table. | Inheritance is often used to create a hierarchy of tables, with child tables extending the functionality of parent tables. |
Regards,
Shravan
Please mark as helpful and mark as correct solution
Shravan
Please mark this as helpful and correct answer, if this helps you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-16-2023 05:29 AM
Thank you Sai.
when the parent table is extended,
1. new fields of the child table are physically created or not? (in your answer it is confusing whether it is for new fields or parent fields)
2. parent fields are accessed in the child table through dot walking? or accessed just like a normal field of child table?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-16-2023 05:48 AM
Hi @manasa0590,
Let me try to clarify on the points you mentioned
When a table is extended in ServiceNow, only the new fields defined in the child table are physically created in the child table. The inherited fields from the parent table are not physically created in the child table, but are accessed through dot walking notation. This means that the inherited fields are still part of the parent table, but they can be accessed from the child table as if they were part of the child table. So, when you extend a parent table in ServiceNow, the child table will have its own physical fields plus the inherited fields from the parent table.
The inherited fields from the parent table are accessed in the child table through dot walking notation. This means that you can access the inherited fields using dot walking notation, like this: "child_table.parent_field". However, since the inherited fields are accessible in the child table just like any other field of the child table, you can also access them directly using their field names, like this: "child_table_field_name". But it is recommended to use dot walking notation to access inherited fields, as it makes the code more readable and easier to understand.
Regards,
Shravan
Shravan
Please mark this as helpful and correct answer, if this helps you
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
ā02-16-2023 07:22 AM
Great! this exactly answers my doubts. Thank you Sai.