to create a problem through incident
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
3 hours ago
Hi, I want to create a problem through an incident, like if I am getting more than 10 incidents with some same configuration, then the problem will be automatically created.
So, for this, I have to create business rules and make custom logic for this functionality, or we have some out-of-the-box things to get the work done.
Thank you...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi @nitinku ,
a. If your requirement on dynamic " same configuration" with multiple fields,
You need to go with Similarity incidents using predictive intelligence
Refer: OOB Similarity definition on incident.
b. If your requirement is with same field "Same configuration" like cmdb_ci field in incident,
Then create a After Update BR.
Sample code:
(function executeRule(current, previous /*null when async*/) {
if (!current.cmdb_ci) {
return;
}
var agg = new GlideAggregate('incident');
agg.addAggregate('COUNT');
agg.addQuery('active', true);
agg.addQuery('cmdb_ci', current.cmdb_ci);
agg.query();
var activeCount = 0;
if (agg.next()) {
activeCount = parseInt(agg.getAggregate('COUNT'), 10);
}
var threshold = 10;
if (activeCount >= threshold) {
var existingProblem = new GlideRecord('problem');
existingProblem.addQuery('cmdb_ci', current.cmdb_ci);
existingProblem.addActiveQuery(); // Checks if the problem is still open
existingProblem.query();
if (!existingProblem.next()) {
var problem = new GlideRecord('problem');
problem.initialize();
problem.short_description = 'Automatic Problem: Multiple (' + activeCount + ') incidents reported for CI: ' + current.cmdb_ci.getDisplayValue();
problem.description = 'A problem was automatically created because there are ' + activeCount + ' active incidents related to configuration item: ' + current.cmdb_ci.getDisplayValue();
problem.cmdb_ci = current.cmdb_ci;
problem.insert();
}
}
})(current, previous);
Regards
Tanushree Maiti
ServiceNow Technical Architect
LinkedIn: https://www.linkedin.com/in/tanushreemaiti
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
2 hours ago
Hi @nitinku
Automatically create problem when more than 4 inci... - Page 2 - ServiceNow Community
refer this solution and change the script according to your requirement