how to fetch the incident attached with problem records through business rule?

jiu
Kilo Contributor

how to fetch the incident attached with problem records through business rule?

1 ACCEPTED SOLUTION

Hi, you can write a BR on the problem record and you can fetch the records. However be careful if the no. of incidents are high in your system, then this could affect the performance of the system as well.

 

Create BR on problem record

When: Display

Select Advanced

(function executeRule(current, previous /*null when async*/) {

// Add your code here
gs.info("problem number is"+current.number);
var inc = new GlideRecord("incident");
inc.addQuery("problem",current.number);
inc.query();
while(inc.next()) {
gs.info("Incident is "+inc.getValue("number"));
}
})(current, previous);

 

Kindly mark my answer as correct if this works for you.

View solution in original post

19 REPLIES 19

Andrii
Kilo Guru

What is your business need? There could be more than one incident related to the same problem record

jiu
Kilo Contributor

i wanted to fetch the incident record which is related to that particular problem

Hi, you can write a BR on the problem record and you can fetch the records. However be careful if the no. of incidents are high in your system, then this could affect the performance of the system as well.

 

Create BR on problem record

When: Display

Select Advanced

(function executeRule(current, previous /*null when async*/) {

// Add your code here
gs.info("problem number is"+current.number);
var inc = new GlideRecord("incident");
inc.addQuery("problem",current.number);
inc.query();
while(inc.next()) {
gs.info("Incident is "+inc.getValue("number"));
}
})(current, previous);

 

Kindly mark my answer as correct if this works for you.

jiu
Kilo Contributor

above code is not working ..