- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2019 01:49 AM
how to fetch the incident attached with problem records through business rule?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2019 02:59 AM
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.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2019 04:23 AM
In the place of release_id use the field name on the change form that is relating to release

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2019 03:58 AM
Hi ,
you can use this code in Display buisiness rule.
(function executeRule(current, previous /*null when async*/) {
// Add your code here
var inc = new GlideRecord("incident");
inc.addQuery("problem_id",current.sys_id);
inc.query();
while(inc.next()){
//gs.addErrorMessage("Row count "+ inc.getRowCount());
gs.addInfoMessage("Incident is :- "+inc.number );
}
it will show you only how many incidents are participates in problem .
and it can do also through After BR .
Please remember it mark as correct and helpful
Thanks
Sanjay Bagri

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2019 04:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-08-2019 04:08 AM
Thanks
in Release , if I add Change request but getting some other record , can u help me in dis
var chg = new GlideRecord("change_request");
chg.addQuery("release_id",current.sys_id);
chg.query();
var change = []
if(chg.next()) {
change.push(chg.number.toString());
}
gs.addInfoMessage("Change(s) is/are "+ change);

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎01-13-2019 12:34 PM
Hey
Any update on this?
If one of the responses provided above resolve your question, please mark the response as correct answer, so future readers can find solution easily.