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-27-2017 12:13 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-27-2017 12:18 AM
sorry, from line 7 should be
if(gr.get(current.cmdb_ci.sys_id))
{
gr.fault_count=gr.fault_count+1;
gr.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2017 03:44 AM
Hello Rusty,
Thank you for your answer.It worked for me after removal of initial if condition.
var gr=new GlideRecord('cmdb_ci_printer');
if(gr.get(current.cmdb_ci.sys_id))
{
gr.fault_count=gr.fault_count+1;
gr.update();
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎11-28-2017 03:53 AM
Jainil,
what is the use case behind this? Only just increasing the fault count will give you just the number of incidents opened in total against this CI. Is this what you are after? Or do you need the number of incidents currently open for this CI? If so, you would need to adjust your logic.
Right now, this number will be an ever increasing number only, and I question the value it gives you.