Creating a record in child table also creates entry in the parent table..please help

camran
Kilo Expert

Hi,

I have a custom table "Father", and a child table "Child". When I enter data in the child table. An entry is created in the parent table as well.

Please guide how to create records in the Child table without interrupting parent table.

See below, entries in Father table, though I created records in Child table.

find_real_file.pngfind_real_file.png

find_real_file.png

8 REPLIES 8

The SN Nerd
Giga Sage
Giga Sage

Gauging from your screenshot and your scenario, it is sounding like your Child Table extends Father. This is your problem.



Using the Task table as an example.



The Incident Table extends Task.


If you create an Incident and view a list of Incidents, you will find it there.


If you view a list of Tasks, you will also find the Incident.


This is because an Incident is a Task.



Let's substitute the terms with your circumstance (Incident with Child, Task with Father), and you will see the issue.


The Child Table extends Father.
If you create a Child and view a list of Childs, you will find it there.


If you view a list of Fathers, you will also find the Child.


This is because a Child is a Father.



See the last sentence there! It doesn't make sense!



Problem/ Incident relationship:


An Incident and a Problem is a Task.


An Incident has a Problem.



Your relationship:


A Father and a Child is a Person.


A Child has a Father.



Alas, you should have a Person table (containing the common fields) that is extended by Father and Child, with a Reference field on Child linking to Father.



ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

Thanks for the detailed answer. Can you please elaborate "Rather, you should have a person table that is extend by Father and Child, with a Reference field on Child linking to Father."


Do you mean



u_father >> (extends) u_child>>(extends) u_person.


And person has a field (reference to father), and a field (reference to child) ??




I will appreciate if you could give a simple example.


  • Person
    • Common fields to Father and Child
  • Father (extends Person)
  • Child (extends Person)
    • 1 extra Reference field to Father

ServiceNow Nerd
ServiceNow Developer MVP 2020-2022
ServiceNow Community MVP 2019-2022

Really appreciate, but one confustion. When I create person table, In the field "extends table". I can only select one table. So i selected "u_child". How can I extend it from both (As you mentioned above) ?



Regards


K