You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This script automates the cleanup of historical records (closed incidents older than 90 days) while preserving records linked to active change requests or tasks. This helps improve system performance and database maintenance.
3
+
4
+
## Use Case
5
+
- Remove outdated incidents that are no longer required.
6
+
- Prevent accidental deletion of records linked to other critical tables.
7
+
- Can be extended to other tables like `problem`, `change_request`, etc.
8
+
9
+
## Script Details
10
+
-**Table:**`incident`
11
+
-**Filter Criteria:**
12
+
- Closed incidents (`state = 7`)
13
+
- Older than 90 days (`closed_at <= gs.daysAgo(90)`)
14
+
-**Safety Checks:** Skips records linked to `change_request` or child `task` records.
15
+
-**Execution:** Can be run as Background Script or Scheduled Script Execution.
16
+
-**Logging:** Outputs skipped and deleted records count in system logs.
0 commit comments