How to increase fault count in a particular Ci's against every Incident created?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-26-2017 11:10 PM
Hello,
We have the incident field called Configuration Item(incident.cmdb_ci), which shows all the details regarding available CIs.
When we open a related CI it's fault count is always '0' and never increases.
Therefore we want a functionality where if a configuration item is selected in an incident then it's count should be incremented in the CI's field Fault count. For eg. Printer(cmdb_ci_printer.name)
How to achieve this? Please provide assistance.
Thank you
Jainil Shah
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-29-2017 05:37 AM
Hello Ulrich,
I was looking for a functionality that increases the number of fault count for every Incident opened against it. Which has been solved now.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎10-25-2018 07:32 AM
I found that the code above didn't work when I set up the business rule. I also wanted it to decrease the fault count if we needed to change the CI, in such cases where the wrong one was added. I ended up with the below code in my business rule.
//add 1 to the fault count of the current CI record.
var gr = new GlideRecord('cmdb_ci_hardware');
gr.addQuery('sys_id', current.cmdb_ci);
gr.query();
if(gr.next()){
gr.fault_count=gr.fault_count+1;
gr.update();
}
//remove 1 from the fault count of the previous CI record.
gr = new GlideRecord('cmdb_ci_hardware');
gr.addQuery('sys_id', previous.cmdb_ci);
gr.query();
if(gr.next()){
gr.fault_count = gr.fault_count-1;
gr.update();
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-14-2019 11:01 PM
The above query is helpful for updating the fault count for the incidents that will be created after the activation of business rule but what about the existing data, the incidents that are already there and whose fault count value is 0. So I want to know the background script to update the fault count of the incidents that are already closed with Certain CI populated but fault count is 0. Can anyone help on this.