Skip to content

Commit 391fcf6

Browse files
committed
Added Validate CI on deployed asset snippet with README and script
1 parent ac2d8b0 commit 391fcf6

File tree

2 files changed

+55
-0
lines changed

2 files changed

+55
-0
lines changed
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
Business Rule: Validate CI on Deployed Assets
2+
3+
Overview : This Business Rule enforces CMDB integrity by ensuring that any asset marked as "Deployed" must be linked to a valid "Configuration Item (CI)". If no CI is associated, the rule automatically notifies the assigned user's manager to take corrective action.
4+
5+
This consists of 3 steps:
6+
1. Business rule
7+
2. Event setup
8+
3. Email Notification
9+
10+
1.Business Rule Configuration
11+
Table: alm_asset
12+
Type: Business Rule
13+
When to run: After Update
14+
Condition : current.install_status == 'Deployed' && !current.ci
15+
16+
2.Event Setup
17+
Go to System Policy > Events > Event Registry
18+
Click New Name: asset.ci.missing
19+
Table: alm_asset
20+
Description: Triggered when deployed asset has no CI
21+
22+
3.Email Notification
23+
Go to System Notification > Email > Notifications
24+
Create a new notification:
25+
Name: Missing CI on Deployed Asset
26+
Table: alm_asset
27+
When to send: Event is fired → asset.ci.missing
28+
Recipients: Event.parm1 (manager)
29+
Subject: Asset numberisdeployedwithoutaCI
30+
Message:
31+
Hello{recipient.name}, The asset ${number} assigned to ${assigned_to.name} is marked as Deployed but has no linked Configuration Item. Please review and take appropriate action. Regards, IT Asset Management
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
(function executeRule(current, previous /*null when async*/) {
2+
3+
4+
// Only act if asset is deployed and has no CI
5+
if (current.install_status == 'Deployed' && !current.ci) {
6+
// Get the user assigned to the asset
7+
var userGR = new GlideRecord('sys_user');
8+
if (userGR.get(current.assigned_to.toString())) {
9+
var manager = userGR.manager;
10+
if (manager) {
11+
// Send notification to manager
12+
gs.eventQueue('asset.ci.missing', current, manager.toString(), current.assigned_to.toString());
13+
gs.info("[Asset-CI Check] Notification sent to manager: " + manager.name);
14+
} else {
15+
gs.info("[Asset-CI Check] Assigned user has no manager.");
16+
}
17+
} else {
18+
gs.info("[Asset-CI Check] Assigned user not found.");
19+
}
20+
}
21+
22+
23+
24+
})(current, previous);

0 commit comments

Comments
 (0)