Skip to content

Commit dfc1015

Browse files
authored
Prevent duplicate update sets (#1383)
* Create preventDuplcateUpdateSets.js This Business Rule is to prevent duplicate names for update sets * Create readme.md
1 parent 24942ab commit dfc1015

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
(function executeRule(current, previous /*null when async*/) {
2+
3+
var updateSetName = current.name.toString().trim();
4+
var grUpdateSet = new GlideRecord('sys_update_set');
5+
grUpdateSet.addQuery('name', updateSetName);
6+
grUpdateSet.addQuery('sys_id', '!=', current.sys_id);
7+
grUpdateSet.query();
8+
9+
if (grUpdateSet.hasNext()) {
10+
gs.addErrorMessage('An update set with this name already exists. Please choose a different name.');
11+
current.setAbortAction(true);
12+
}
13+
14+
})(current, previous);
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
This Business Rule will help to prevent duplicate names for update set. And this will display error message when there is duplicate name found for update set name.

0 commit comments

Comments
 (0)