Skip to content

Commit 886cbb9

Browse files
Create Readme.md
Auto close incident if all related changes are closed
1 parent 4cc0540 commit 886cbb9

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
Business Rule: Auto-Close Incident When All Related Changes Are Closed
2+
Table : change_request
3+
When to Run: After update
4+
Condition: state changes to Closed (or your equivalent "Closed" state number, e.g. state == 3)
5+
6+
Detailed Working
7+
1. Trigger Point
8+
This After Business Rule runs after a Change Request record is updated.
9+
Specifically, it checks when the state changes to “Closed”.
10+
11+
2. Check for Related Incident
12+
The script retrieves the incident reference field (incident) from the current change request.
13+
If there’s no linked incident, it skips execution.
14+
15+
3. Check for Any Remaining Open Change Requests
16+
A new GlideRecord query checks for other Change Requests linked to the same incident where:
17+
If any such records exist, it means not all change requests are closed — so the incident remains open.
18+
19+
4. Close the Incident Automatically
20+
If no open Change Requests remain, the script:
21+
Fetches the linked incident.
22+
Sets: state = 7 (Closed)
23+
close_code = Auto Closed
24+
close_notes = Auto closure as all changes are closed.
25+
Updates the record.

0 commit comments

Comments
 (0)