Skip to content

Commit 7c5378a

Browse files
authored
BR to copy worknotes from child to parent (#2662)
* Create script.js * Create read.md
1 parent e7aa2f9 commit 7c5378a

File tree

2 files changed

+26
-0
lines changed

2 files changed

+26
-0
lines changed
Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
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.
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)