Skip to content

Commit 15b6c2e

Browse files
authored
Business rule for creating task based on field
1 parent e9d40d2 commit 15b6c2e

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
(function executeRule(current, previous) {
2+
// Check if the priority is critical and a follow-up task doesn't already exist
3+
if (current.priority == 1 && !current.u_follow_up_task_created) { // Assuming 1 is critical priority, and u_follow_up_task_created is a custom boolean field
4+
var grTask = new GlideRecord('sc_task');
5+
grTask.initialize();
6+
grTask.short_description = "Follow-up for Critical Incident: " + current.number;
7+
grTask.parent = current.sys_id;
8+
grTask.insert();
9+
current.u_follow_up_task_created = true; // Mark that a task has been created
10+
current.update(); // Update the incident to reflect the task creation
11+
}
12+
})(current, previous);

0 commit comments

Comments
 (0)