Skip to content

Commit 6e6b3fe

Browse files
authored
Create br_validate_short_description.js
1 parent f3d0416 commit 6e6b3fe

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
// Name: Validate Short Description
2+
// Table: Incident
3+
// When: before insert or before update
4+
// Order: 100
5+
6+
(function executeRule(current, previous /*null when async*/) {
7+
var short_desc = current.getValue('short_description');
8+
9+
// Validate only for new records or when field changes
10+
if (current.operation() === 'insert' || current.short_description.changes()) {
11+
if (!short_desc || short_desc.trim().length < 40) {
12+
current.short_description.setError('Short description must be at least 40 characters long.');
13+
current.setAbortAction(true);
14+
}
15+
}
16+
})(current, previous);

0 commit comments

Comments
 (0)