- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2022 05:10 PM
Hi all,
I have noticed that the OOTB related lists from the instance are not working as excpected.
For example, if I add an incident to the the related list incident.rfc in a change request I can't see it in the related list.
As you can see in the below images
I'm using the OOTB related lists : incident.rfc and change_request.parent
Any ideas?
Solved! Go to Solution.
- Labels:
-
Scripting and Coding

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2022 06:41 AM
Hi,
When you associate that incident to the change in the related list: "Incidents fixed by Change":
a relationship is made by placing the change request reference in the Incident Related Records tab and the Change Request field:
So that's where the relationship would show. If you want it to show in the Change Requests related list on the Incident, then you'd have to set the "Parent" field on the incident to that record as well (you could accomplish this by creating a "before" business rule on the incident table with a condition that the change request field changes) and then check the "Advanced" checkbox, go to the Advanced tab, and use a simple script such as:
current.parent = current.rfc;
However, your sort of changing the meaning of that related list, but if that is what is relevant to your organization, then so be it. It's only going to show the one record though? So you could just train users to look at the related records tab and the change request field if they need to see a related change request and then remove the "change request" related list from the incident form if it causes any confusion.
The last thing you could do is create a new relationship (new related list): https://docs.servicenow.com/bundle/rome-platform-user-interface/page/administer/form-administration/... and then use settings such as (EXAMPLE😞
and script like:
(function refineQuery(current, parent) {
current.addQuery('sys_id', parent.rfc);
})(current, parent);
Then add that related list to your incident form and it'd look like this:
And then you could remove the Change Request > Parent related list currently shown.
So I've given you like 3 options basically to go with to accomplish this.
Hopefully that resolves your issue?
Please mark reply as Helpful/Correct, if applicable. Thanks!
Please consider marking my reply as Helpful and/or Accept Solution, if applicable. Thanks!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2022 06:19 PM
The 1st related list shows Incidents where field Change Request is filled in with a reference to the current Change Request - so it shows up in the related list.
The 2nd related list shows Change Requests where field Parent is filled in with a reference to the current incident. By updating reference Change Request on an Incident, does not automatically update the same Change Request by setting field Parent to refer to the incident Involved - so nothing show up in the related list.
In other words the two related lists show their data based on different data and updating an Incident to point to a Change Request (through field Change Request) does not automatically update the Change Request to point to the same Incident (through field Change Request).
In other words things are working fine, as expected.
If you want to show the list of Change Requests as Incident related list, displaying those Change Request that are referenced by an Incident through the Change Request field, is kinda' pointless, the same info can be had on the form (perhaps is already there) by showing the Change Request field.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-24-2022 06:48 PM
Well we have a requirement to show in incident form in the change related list all the changes that were executed to fix that incident.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-25-2022 12:45 AM
The O(ut) O(f the) B(box)/OOB solution to "link" changes to incidents is based on the premise that a single Change Request will "fix" an Incident. Thus when one uses the "Create Normal|Standard|Emergency Change" form context menu UI Action, the created Change will receive no reference to the creator Incident. Only the Incident will be updated to point to the created Change Request (via the Change Request field I mentioned previously). In fact as soon as one uses the "Create X Change" form context menu and the Incident's "Change Request" field receives a value, those "Create X Change" menu items are no longer shown.
Long story short, if you need to "link" multiple fixer Change Requests to a single Incident, you will need to come up with a custom solution. Either an m2m (many-to-many) table or a field on the Change Request table to hold a reference to the "parent" Incident. Using field Parent might not be the best choice: it would be appropriate that a parent of a Change Request to also be a Change Request. So perhaps an m2m table would be the best choice. Such tables - as far as I have seen - are excluded from extra license charges - are not considered licensable custom tables (but you'd better make sure that that is the case by contacting your SN rep.) and can be made to behave like the "Group Members" related list on "Group" records: to sport both a "New" and an "Edit..." UI Action that would allow one to designate (and thus associate) any Change as "fixer" of the current Incident.
You can create such m2m tables by typing sys_m2m.list
(or sys_m2m.do
) into the Navigator Filter and hitting the Enter key:
Or maybe someone else has an OOB solution - let's hope.