Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
Cascade Problem Worknotes to Origin Task

Script Type : Business Rule Trigger: after update Table: problem Condition: Work Notes Changes

Goal : To Notify to that particular record(ticket) when Problem record has updated the worknotes.

Walk through of code :
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.
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
(function executeRule(current, previous /*null when async*/ ) {

/*
Input
1. Worknotes changes in Problem

Validation & Check
Exclusion of Closed & Resolved State Problems

Output
Updatation of Origin Task record worknotes

*/

// Getting the Problem current worknotes
var workNotes = '';
if (current.work_notes.changes() && (current.state != 107 && current.state != 106)) {
workNotes = current.work_notes.getJournalEntry(1).match(/\n.*/gm).join(" ");

// To update in the Origin Task field directyl by using the getRefRecord() mehtod.
var inc_rec = current.first_reported_by_task.getRefRecord();
inc_rec.work_notes = "Update on : " + current.number + workNotes;
inc_rec.update();
}



})(current, previous);