Get a first look at what's coming. The Developer Passport Australia Release Preview kicks off March 12. Dive in! 

Add Child of Incidents to Problem tickets

Cat
Giga Guru

Hi all,

 

We may attach a parent incident to a problem. Is there a way to add the list of child incidents to the problem? These are incidents where they are only attached to the parent - not the problem. Only the parent would be attached to the problem.

 

Thanks,

Cat

12 REPLIES 12

Thank you Ankur, this is very helpful, I will check this out and then let you know how I get on!

With this approach, you are duplicating data that already exists in the Incident record and then showing it again on the Problem record. My recommendation is to use the out-of-the-box (OOTB) approach unless there is a specific compliance requirement.

*************************************************************************************************************
Regards
Dr. Atul G. - Learn N Grow Together
ServiceNow Techno - Functional Trainer
LinkedIn: https://www.linkedin.com/in/dratulgrover
YouTube: https://www.youtube.com/@LearnNGrowTogetherwithAtulG
Topmate: https://topmate.io/dratulgrover [ Connect for 1-1 Session]

****************************************************************************************************************

The request is that they can easily see how many incidents are affected by a problem. OOB I would have expected that it would link the child incidents. If the problem is only identified after the incidents have been closed, they would have to link every single incident to the problem rather than just the parent incident.

@Dr Atul G- LNG 

this won't duplicate the data/records.

This will simply show the child incidents as related list

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader

@Cat 

here is the working approach

1) create relationships from System Definition like this

AnkurBawiskar_0-1771468589087.png

 

(function refineQuery(current, parent) {

    // get the incident associated with this problem and then get child of that parent
    var rec = new GlideRecord('incident');
    rec.addQuery('problem_id', parent.sys_id);
    rec.query();
    if (rec.next()) {
        var parentInc = rec.getUniqueValue();
        var childIncArr = [];
        var gr = new GlideRecord("incident");
        gr.addQuery("parent", parentInc).addOrCondition("parent_incident", parentInc);
        gr.query();
        while (gr.next()) {
            childIncArr.push(gr.getUniqueValue());
        }
		current.addQuery('sys_id', 'IN', childIncArr.toString());
    }
})(current, parent);

2) this Problem has parent as INC0010118

AnkurBawiskar_1-1771468615101.png

 

 

3) this INC is parent of 3 incidents

AnkurBawiskar_2-1771468629435.png

 

 

4) now add that related list on Problem form Right Click -> Configure Related List 

AnkurBawiskar_3-1771468706476.png

 

5) then add that new related list to right side

AnkurBawiskar_4-1771468749899.png

 

Output: 3 child incidents now shown in related list on form

AnkurBawiskar_5-1771468780661.png

💡 If my response helped, please mark it as correct and close the thread 🔒— this helps future readers find the solution faster! 🙏

Regards,
Ankur
Certified Technical Architect  ||  10x ServiceNow MVP  ||  ServiceNow Community Leader