Skip to content

Commit 738e608

Browse files
authored
Create readme.md
1 parent 8949d6d commit 738e608

File tree

1 file changed

+25
-0
lines changed
  • Core ServiceNow APIs/GlideRecord/CheckDuplicate-Server

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+
Scan all Servers (cmdb_ci_server). For each one, check if there is another CI in cmdb_ci_computer with the same name but not a server (sys_class_name != cmdb_ci_server).
2+
3+
If found, log the server name and the duplicate CI’s class; keep a running duplicate count; finally log the total.
4+
5+
*******Descriton****
6+
1. var gr = new GlideRecord("cmdb_ci_server");
7+
2. Creates a record set for Server CIs.
8+
9+
10+
gr.addEncodedQuery("sys_class_name=cmdb_ci_server");
11+
3. Redundant: you’re already targeting the cmdb_ci_server table which is a class table. This filter doesn’t harm, but it’s unnecessary.
12+
13+
14+
while (gr.next()) { ... }
15+
4. Loops through each server CI.
16+
17+
18+
5.Inside loop:
19+
20+
Query cmdb_ci_computer for records with the same name but where sys_class_name != cmdb_ci_server.
21+
6. If found, log the duplicate and increment dupCount.
22+
23+
24+
25+
7. Finally logs total dupCount.

0 commit comments

Comments
 (0)