From de666b7917a0cd8eaf113b4f6215e490966a47c9 Mon Sep 17 00:00:00 2001 From: kishoretk92 Date: Fri, 31 Oct 2025 21:22:38 +0530 Subject: [PATCH 1/2] Create script.js --- .../Business Rules/Copy Worknotes/script.js | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 Server-Side Components/Business Rules/Copy Worknotes/script.js diff --git a/Server-Side Components/Business Rules/Copy Worknotes/script.js b/Server-Side Components/Business Rules/Copy Worknotes/script.js new file mode 100644 index 0000000000..8868fb7a05 --- /dev/null +++ b/Server-Side Components/Business Rules/Copy Worknotes/script.js @@ -0,0 +1,22 @@ +/Copy work notes to parent +/* Checks if work notes have changed in the current record. +If yes, it copies the latest journal entry to the parent’s work notes. +Sets the updated flag to true.*// +(function executeRule(current, previous) { + if (!current.parent) return; + + var parent = current.parent.getRefRecord(); + if (!parent.isValidRecord()) return; + + var updated = false; + + + if (current.work_notes.changes()) { + parent.work_notes = current.work_notes.getJournalEntry(1); + updated = true; + } + + if (updated) { + parent.update(); + } +})(current, previous); From 5394562fb9420c38deeefbc3bd98779d0e757152 Mon Sep 17 00:00:00 2001 From: kishoretk92 Date: Fri, 31 Oct 2025 21:23:19 +0530 Subject: [PATCH 2/2] Create read.md --- Server-Side Components/Business Rules/Copy Worknotes/read.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 Server-Side Components/Business Rules/Copy Worknotes/read.md diff --git a/Server-Side Components/Business Rules/Copy Worknotes/read.md b/Server-Side Components/Business Rules/Copy Worknotes/read.md new file mode 100644 index 0000000000..e70d452e20 --- /dev/null +++ b/Server-Side Components/Business Rules/Copy Worknotes/read.md @@ -0,0 +1,4 @@ +Copy work notes to parent +Checks if work notes have changed in the current record. +If yes, it copies the latest journal entry to the parent’s work notes. +Sets the updated flag to true.