How to create Parent-Child relationship between two tables?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-22-2016 08:01 AM
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.,
Is this possible to to? or do you suggest some other best way?
Thanks,
Rajini
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2016 09:53 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2016 10:01 PM
Yes , the above link mentioned by Geoffrey can help you.
Thanks
Pradeep D J
PS - Please mark Helpful, Like, or Correct Answer if applicable.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2016 10:26 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-27-2016 10:20 PM