How to increase fault count in a particular Ci's against every Incident created?

Community Alums
Not applicable

Hello,

We have the incident field called Configuration Item(incident.cmdb_ci), which shows all the details regarding available CIs.

CI field in Incident.jpg

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)

Fault count.jpg

How to achieve this? Please provide assistance.

Thank you

Jainil Shah

7 REPLIES 7

ruzzty06
Tera Expert

You can create a business rule for Incident Table. You can change conditions as to your specific needs.


find_real_file.png


find_real_file.png


sorry, from line 7 should be



if(gr.get(current.cmdb_ci.sys_id))


{


gr.fault_count=gr.fault_count+1;


gr.update();


}


Community Alums
Not applicable

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();


}


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.