- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-03-2021 10:39 PM
Hi All,
We have a requirement where i need to show RITM's parent as well child of that particular RITM in requested item related list on RITM form.
Pls help.
Solved! Go to Solution.
- Labels:
-
Service Catalog
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2021 12:51 AM
Hi Nikita,
So here you go
My Example has this:
RITM0010028 is parent of RITM0010029
RITM0010029 is parent of RITM0010027
RITM0010029 is parent of RITM0010026
1) Create defined relationship from left navigation -> Relationships -> System Definition
Name - Related RITMs
a) Applies to table - sc_req_item
b) Queries from table - sc_req_item
Script:
(function refineQuery(current, parent) {
// Add your code here, such as current.addQuery(field, value);
var ritmSysId = parent.parent;
var currentSysId = parent.sys_id;
// get the childs
var arr = [];
var gr = new GlideRecord("sc_req_item");
gr.addQuery("parent","IN", currentSysId);
gr.query();
while(gr.next()) {
arr.push(gr.getValue('sys_id'));
}
current.addQuery("sys_id", "IN", arr.toString()).addOrCondition("sys_id", parent.parent);
})(current, parent);
Then add it on the related list by Configure -> Related Lists
Output: RITM0010029 related list will show it's child RITM0010027 and RITM0010026 and also it's parent RITM0010028
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2021 11:11 PM
Hi Nikita,
For defined/custom relationship it is not possible.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-05-2021 07:24 AM
Please mark my response as correct and helpful as I have provided the solution to your question.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2021 10:02 PM
Hi Ankur,
Client wants the filter in breadcrumbs. Is there any way we can do it?
Regards,
Nikita
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-07-2021 10:09 PM
Not possible as this is defined/custom relationships.
I believe I have answered your original question.
Please mark my response as correct and helpful and close the question.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-04-2021 11:11 PM
Please mark my response as correct and helpful as I have provided the solution to your question.
Regards
Ankur
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader