Link Child Incidents to Parent directly

SN Rookie
Giga Expert

Hi Team,

On INCIDENT Table, there's a custom field drop-down 'Primary Root Cause' and if drop down value is chosen as 'To be investigated via PROBLEM record' , it automatically creates a PROBLEM record on Resolution of Incident. The problem is if we have 'x' number of Child Incidents linked with a PARENT INCIDENT, it creates 'x' number of Problem tickets because the primary root cause field value flows from Parent incident to Child incident.

The requirement is - 

If there are child incidents attached to a Parent incident, and the Primary Root Cause is chosen as To be investigated via PROBLEM record, it should only create 1 Problem record, and all the subsequent child incidents should get attached to this Problem ticket.

How can we achieve this via a Business rule?

1 ACCEPTED SOLUTION

Sanbir Singh1
Kilo Guru

Hi Rookie,

Please try this code in your BR on Incident table, remove the condition Problem is empty in your condition and check that in code directly. - 

 

if(current.problem_id == ""){
var generateProblem = new CreateProblemFromIncident();
generateProblem.createProblem();
current.update();
}



if(current.problem_id != "")
{
var chkNum = new GlideRecord('incident');
chkNum.addQuery('parent_incident',current.sys_id);
chkNum.query();
while(chkNum.next()){
chkNum.problem_id = current.problem_id;
chkNum.update();
}
}

 

Kindly mark helpful/resolved if it helps you.

View solution in original post

6 REPLIES 6

Sanbir Singh1
Kilo Guru

Hi Rookie,

Please try this code in your BR on Incident table, remove the condition Problem is empty in your condition and check that in code directly. - 

 

if(current.problem_id == ""){
var generateProblem = new CreateProblemFromIncident();
generateProblem.createProblem();
current.update();
}



if(current.problem_id != "")
{
var chkNum = new GlideRecord('incident');
chkNum.addQuery('parent_incident',current.sys_id);
chkNum.query();
while(chkNum.next()){
chkNum.problem_id = current.problem_id;
chkNum.update();
}
}

 

Kindly mark helpful/resolved if it helps you.

SN Rookie
Giga Expert

Woah, that worked Sanbir.

 

Thanks for your help!