We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 7d927da commit c5ea0abCopy full SHA for c5ea0ab
Server-Side Components/Business Rules/Prevent Duplicate CI (Configuration Item) Names/code_snippet.js
@@ -0,0 +1,15 @@
1
+// Business Rule to Block users from saving a CI with a duplicate name but different class
2
+// Before Insert Business Rule on cmdb_ci table
3
+(function executeRule(current, previous /*null when async*/) {
4
+
5
+ var ci = new GlideRecord('cmdb_ci');
6
+ ci.addQuery('name', current.name);
7
+ ci.addQuery('sys_id', '!=', current.sys_id);
8
+ ci.query();
9
10
+ if (ci.next()) {
11
+ gs.addErrorMessage('A Configuration Item with this name already exists!');
12
+ current.setAbortAction(true);
13
+ }
14
15
+})(current, previous);
0 commit comments