- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2022 05:09 AM
Hello SNC,
I have an requirement that - To add Parent/Child relationship for Problem table.
I.e., When i add list of problems in the related list problem tab then all those will be considered as child problem and thus when i open any child problem record then the parent problem number should be published in the related records >> parent problem.
Any advice?
Solved! Go to Solution.
- Labels:
-
Problem Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2022 11:24 PM
Hello Kingstan,
To achieve this you can go to System Definition --> Relationships. Click on New button:
Create a new record as shown below:
Put the below script in Query with field on your record :
(function refineQuery(current, parent) {
var parentProblemID = parent.getValue("parent");
current.addQuery("sys_id", parentProblemID);
})(current, parent);
Go to the problem table and open any child problem record. Right click on form header go to Configure --> Related Lists
Search Parent Problem under Available section and move it to selected section and click on Save
You will now see the Parent Problem related list which will show the Parent Problem.
Please mark my respsone as helpful/correct, if it answer your question.
Thanks

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2022 05:21 AM
Hi
I assume you are using Parent field to build parent/child relationship b/w problems. If so, you can go to Configure > Related list and add Problem -> Parent. This will give you child problems
for the current record in the related list.
For displaying parent problems in the list you need to build defined relationship [custom relatedlist]. You can see the documentation here at Create defined related lists | Servicenow Docs
At the bottom of the page you have couple of example codes which can be handy.
Let me know if you have any questions.
Please mark this helpful/correct, if applicable.
Regards,
Muhammad
Muhammad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-02-2022 10:24 PM
Hi Muhammad, Thanks.
But if you see my screenshot. I have already established parent relationship via related list (See screen-grab at related list). I created on field at the form as Parent problem (See screen-grab at problem form).
Now, My objective is to create parent-child relationship.
i.e., on the related list when i choose a problem it will be child of that parent. Thereby in the form of the child at parent problem field that parent problem should reflect.
Any advice?

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-03-2022 07:35 AM
Below is the configuration:
Name: Name of your choice. This will appear as label on the related list.
Parent: Problem
Child: Problem
Script:
(function refineQuery(current, parent) {
// Add your code here, such as current.addQuery(field, value);
current.addQuery('sys_id', parent.parent);
})(current, parent);
Open Problem form, Configure Related list and add "Custom Problem" [name of custom relations we built above].
Now the parent problems will appear on the child problem.
Please mark this helpful/correct, if applicable.
Muhammad
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎09-01-2022 05:30 AM
Hi,
please refer below link.
https://community.servicenow.com/community?id=community_question&sys_id=7581136ddbdcdbc01dcaf3231f96191d
Thanks,
Pavankumar
ServiceNow Community MVP 2024.
Thanks,
Pavankumar