Skip to content

Commit c5c788f

Browse files
authored
Create prevent_continous_update.js
BR Code
1 parent af88ba1 commit c5c788f

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
(function executeRule(current, previous) {
2+
3+
if (current.isNewRecord() || !current.isValidRecord() || current.operation() == 'delete') {
4+
return;
5+
}
6+
var fieldsToCheck = ['work_notes', 'comments', 'state'];
7+
var allFieldsSame = true;
8+
for (var i = 0; i < fieldsToCheck.length; i++) {
9+
var field = fieldsToCheck[i];
10+
if (current.changes.call(current, field) && current[field].toString() !== previous[field].toString()) {
11+
allFieldsSame = false;
12+
break;
13+
}
14+
}
15+
if (allFieldsSame) {
16+
gs.info('BR skipped redundant integration update for ' + current.sys_class_name + ': ' + current.number);
17+
current.setAbortAction(true);
18+
}
19+
20+
})(current, previous);

0 commit comments

Comments
 (0)