- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2025 09:08 PM
Hi Community,
Is it expected that a child record created in a child table is being stored in parent table as well? Is there any way to avoid this from happening? I have a table b (child) which extends table a (parent) and I don't want the child records in the child table being available in parent table as well.
Thank you.
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2025 09:16 PM
Hello @Vee Jay Recana -
In ServiceNow, when a child table extends a parent table, the records from the child table are also stored in the parent table's underlying data model. This is part of how table extensions work in ServiceNow, where the child table inherits fields from the parent table. This means that records in the child table are available when querying the parent table because the child table extends the parent.
Unfortunately, there isn't a way to completely prevent child records from showing up in the parent table without modifying the data model, as this is intrinsic to the design of table inheritance in ServiceNow.
However, you can implement filtering or security rules to prevent child table records from being exposed when querying the parent table:
1. Use conditions in queries: When querying the parent table, you can exclude records from child tables by adding conditions, such as checking the `sys_class_name` field. For example:
var parentTableRecords = new GlideRecord('parent_table');
parentTableRecords.addQuery('sys_class_name', 'parent_table'); // Only get parent table records
parentTableRecords.query();
2. Use ACLs: You can create Access Control Rules (ACLs) that restrict access to child table records when someone queries the parent table.
These approaches won't prevent the records from being stored in the parent table but can help avoid displaying or exposing them in certain use cases.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards,
Kaustubh
If you found my response helpful, please mark it as correct and close the thread to benefit others.
Regards,
Kaustubh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-25-2025 09:16 PM
Hello @Vee Jay Recana -
In ServiceNow, when a child table extends a parent table, the records from the child table are also stored in the parent table's underlying data model. This is part of how table extensions work in ServiceNow, where the child table inherits fields from the parent table. This means that records in the child table are available when querying the parent table because the child table extends the parent.
Unfortunately, there isn't a way to completely prevent child records from showing up in the parent table without modifying the data model, as this is intrinsic to the design of table inheritance in ServiceNow.
However, you can implement filtering or security rules to prevent child table records from being exposed when querying the parent table:
1. Use conditions in queries: When querying the parent table, you can exclude records from child tables by adding conditions, such as checking the `sys_class_name` field. For example:
var parentTableRecords = new GlideRecord('parent_table');
parentTableRecords.addQuery('sys_class_name', 'parent_table'); // Only get parent table records
parentTableRecords.query();
2. Use ACLs: You can create Access Control Rules (ACLs) that restrict access to child table records when someone queries the parent table.
These approaches won't prevent the records from being stored in the parent table but can help avoid displaying or exposing them in certain use cases.
If my response helped please mark it correct and close the thread so that it benefits future readers.
Regards,
Kaustubh
If you found my response helpful, please mark it as correct and close the thread to benefit others.
Regards,
Kaustubh