Skip to content

Commit 7caa418

Browse files
authored
Cascade of worknotes from Problem to Origin task
1 parent 56653db commit 7caa418

File tree

2 files changed

+36
-0
lines changed
  • Server-Side Components/Business Rules/Cascade Problem Worknote to Origin Task

2 files changed

+36
-0
lines changed
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
Cascade Problem Worknotes to Origin Task
2+
3+
Script Type : Business Rule Trigger: after update Table: problem Condition: Work Notes Changes
4+
5+
Goal : To Notify to that particular record(ticket) when Problem record has updated the worknotes.
6+
7+
Walk through of code :
8+
So when there is update/change in the worknotes of a problem record this Business rule will cascade the worknotes to that attached Origin Task record so that it will be update in that particular record as well. In this some validation have been used to avoid unnecessary data cascade, this Business will work only for the open problem, mean this it will exclude the Closed & Resolved State Problem which have been already addressed. So once the worknote is posted it will updated respectively to the origin task.
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
(function executeRule(current, previous /*null when async*/ ) {
2+
3+
/*
4+
Input
5+
1. Worknotes changes in Problem
6+
7+
Validation & Check
8+
Exclusion of Closed & Resolved State Problems
9+
10+
Output
11+
Updatation of Origin Task record worknotes
12+
13+
*/
14+
15+
// Getting the Problem current worknotes
16+
var workNotes = '';
17+
if (current.work_notes.changes() && (current.state != 107 && current.state != 106)) {
18+
workNotes = current.work_notes.getJournalEntry(1).match(/\n.*/gm).join(" ");
19+
20+
// To update in the Origin Task field directyl by using the getRefRecord() mehtod.
21+
var inc_rec = current.first_reported_by_task.getRefRecord();
22+
inc_rec.work_notes = "Update on : " + current.number + workNotes;
23+
inc_rec.update();
24+
}
25+
26+
27+
28+
})(current, previous);

0 commit comments

Comments
 (0)