How to create Parent-Child relationship between two tables?

Community Alums
Not applicable

I want to create Parent Child relationship between cmdb_ci(Class=Application) and sc_cat_item tables. I want the sc_cat_item to be the child table.

Is it possible to create the new relationship same as 'cmdb_rel_ci' table (CI Relationships)? I need the same columns 'Parent', 'Child', 'Type' etc in my new table.,

find_real_file.png

Is this possible to to? or do you suggest some other best way?

Thanks,

Rajini

5 REPLIES 5

Geoffrey2
ServiceNow Employee
ServiceNow Employee

I think what you want is to define a new entry in the sys_m2m table: http://wiki.servicenow.com/index.php?title=Creating_a_Many-to-Many_Relationship


Yes , the above link mentioned by Geoffrey can help you.




Thanks
Pradeep D J



PS - Please mark Helpful, Like, or Correct Answer if applicable.


A Parent-Child relationship can be created by adding a reference field the references that parent table on the child table.


Similar to the OOB Change and Change Task relationship.



If there is a requirement for a child to have more than one parent, then you will to create a many to many as mentioned above.



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

fkhan
Kilo Guru

Hi Rajinis,


Check this screen shot'


:find_real_file.png


You need create a same kind of relationship for your parent and child table.


Thanks,


Farukh



PS - Please mark Helpful, Like, or Correct Answer if applicable.