Skip to content

Commit 3b2935a

Browse files
Update related tasks when parent changes (#1827)
* Readme.md * script.js
1 parent 85f20b7 commit 3b2935a

File tree

2 files changed

+15
-0
lines changed

2 files changed

+15
-0
lines changed
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
This Business Rule ensures that whenever the priority of a Change Request is updated, all related Change Tasks automatically inherit the same priority.
2+
3+
This helps maintain data consistency and ensures that task prioritization aligns with the parent change.
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
(function executeRule(current, previous) {
2+
//when the priority field changes
3+
if (current.priority.changes()) {
4+
var task = new GlideRecord('change_task');
5+
task.addQuery('change_request', current.sys_id);//Find all tasks related to this Change Request
6+
task.query();
7+
while (task.next()) {
8+
task.priority = current.priority; //Update the task priority
9+
task.update();
10+
}
11+
}
12+
})(current, previous);

0 commit comments

Comments
 (0)