Skip to content

Commit de666b7

Browse files
authored
Create script.js
1 parent 1106276 commit de666b7

File tree

1 file changed

+22
-0
lines changed
  • Server-Side Components/Business Rules/Copy Worknotes

1 file changed

+22
-0
lines changed
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
/Copy work notes to parent
2+
/* Checks if work notes have changed in the current record.
3+
If yes, it copies the latest journal entry to the parent’s work notes.
4+
Sets the updated flag to true.*//
5+
(function executeRule(current, previous) {
6+
if (!current.parent) return;
7+
8+
var parent = current.parent.getRefRecord();
9+
if (!parent.isValidRecord()) return;
10+
11+
var updated = false;
12+
13+
14+
if (current.work_notes.changes()) {
15+
parent.work_notes = current.work_notes.getJournalEntry(1);
16+
updated = true;
17+
}
18+
19+
if (updated) {
20+
parent.update();
21+
}
22+
})(current, previous);

0 commit comments

Comments
 (0)