0% found this document useful (0 votes)
12 views2 pages

Incident Management Automation Rules

The document outlines several requirements for incident management in a system, including auto-closing resolved incidents, preventing duplicate incidents, and limiting active incidents per configuration item (CI). It also details the process for updating parent incidents when child incidents are resolved and the automatic creation of problem records for critical CIs. Additionally, it specifies that parent incidents should only be closed after all related child tasks are completed.

Uploaded by

Sahil Shinde
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
12 views2 pages

Incident Management Automation Rules

The document outlines several requirements for incident management in a system, including auto-closing resolved incidents, preventing duplicate incidents, and limiting active incidents per configuration item (CI). It also details the process for updating parent incidents when child incidents are resolved and the automatic creation of problem records for critical CIs. Additionally, it specifies that parent incidents should only be closed after all related child tasks are completed.

Uploaded by

Sahil Shinde
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd

------------------------------------------------------------------------------

1. Auto-close resolved incidents


Requirement: When an incident state changes to Resolved, automatically set the
close_code to "Solved (Permanently)" and close_notes to "Auto-closed by system".

--> use after and update


current.close_code = "Duplicate";
current.close_notes = "Auto-closed by system";
[Link] = 6;
[Link]();

-------------------------------------------------------------------------------
2. Prevent duplicate incidents
Requirement: If a user tries to create an incident with the same short_description
and caller within the last 24 hours, stop creation and show a message.

--> before and insert


var grIncident2 = new GlideRecord('incident');
[Link]("short_description", current.short_description);
[Link]("caller_id", current.caller_id);
[Link]('sys_created_on', '>=', [Link](1));
[Link]();

while ([Link]()) {
[Link]("An incident with the same short description already
exists");
[Link](true);
}

-------------------------------------------------------------------------------
3. Limit open incidents per CI
Requirement: Prevent more than 3 active incidents from being created for the same
cmdb_ci.

var ga = new GlideAggregate("incident");


[Link]("cmdb_ci", current.cmdb_ci);
[Link]("active", true);
[Link]("COUNT");
[Link]();

if ([Link]() && [Link]("COUNT") >= 3) {


[Link]("Only 3 active incidents are allowed for this CI.");
[Link](true);
}

-------------------------------------------------------------------------------
Update parent incident
Requirement: If a child incident is resolved, update the parent incident's
work_notes with a message "Child incident [number] has been resolved".

-->
if ([Link] == 6 && [Link] != 6) {

// Check if the incident has a parent


if (current.parent_incident) {
var parent = new GlideRecord("incident");

if ([Link](current.parent_incident)) {
parent.work_notes = "Child incident " + [Link] + " has been
resolved";
[Link]();
}
}
}

-------------------------------------------------------------------------------
Auto-create problem record
Requirement: When an incident is created for a Critical CI, automatically create a
related problem record.
-------------------------------------------------------------------------------

6. parent child should be closed first then finally parent table is closed:

var grTask = new GlideRecord('incident_task');


[Link]('incident', [Link]); // same parent incident
[Link]('state', '!=', 3); // exclude Closed Complete
[Link]();

// If no open tasks remain


if (![Link]()) {
var grInc = new GlideRecord('incident');
if ([Link]([Link])) {
[Link] = 2; // Closed (adjust value for your instance)
//grInc.close_code = 'Closed/Resolved by System';
// grInc.close_notes = 'Automatically closed since all child tasks are
closed.';
[Link]();
}
}

You might also like