How to get child incidents for all parent incidents in a report

pavankum
Kilo Expert

We have parent child relationships in incident. we would like to pull a report which have child incidents.

Like for example if a parent is having 3 childs in a report i need to know the parent and incidents associated with parents...

can anyone help me to pull a report on it?

4 REPLIES 4

marcguy
ServiceNow Employee
ServiceNow Employee

I would add filter: Parent IS NOT EMPTY



Group By: Parent



that should bring back all children grouped by their parent.


Thanks for the reply mguy, Yeah that way i am also able to generate reports. but when i export to excel incident is having 3 childs and related incidents field showing 3. Now i need to see child numbers beside each parent incident.



For ex: INC1 is having INC2 and INC3 as childs my report should be like this



Parent                               childs


-----------                 ---------------------


INC1                             INC2, INC3


You for that, aside from making a custom chart, you would need to add an additional string field (ie: u_children_summary) and create a rule to trigger on incident after updates when parent.changes();


The BR could look like this:


=== Script follows ===


var papa = new GlideRecord('incident');


papa.addQuery('sys_id', current.parent);


papa.query();


papa.next();


var children = new GlideRecord('incident');


children.addQuery('parent', papa.sys_id)


children.query();


papa.u_children_summary = '';


while (children.next()){


      if(papa.u_children_summary != ''){


              papa.u_children_summary = papa.u_children_summary + ", ";


      }


      papa.u_children_summary = papa.u_children_summary + children.number;


}


=== {untried, might need tweaking} ===


Hi Pavan,

 

Can you tell if you able to do what you wanted? If yes, can you please confirm how did you do that? THe exact report?