Skip to content
Closed
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,12 @@
(function executeRule(current, previous) {
// Check if the priority is critical and a follow-up task doesn't already exist
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
var grTask = new GlideRecord('sc_task');
grTask.initialize();
grTask.short_description = "Follow-up for Critical Incident: " + current.number;
grTask.parent = current.sys_id;
grTask.insert();
current.u_follow_up_task_created = true; // Mark that a task has been created
current.update(); // Update the incident to reflect the task creation
}
})(current, previous);
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
Creating a Task Based on a Field Value:

This Business Rule runs "after" an insert or update to an Incident to automatically create a new "Follow-up Task" if the "Priority" is set to "Critical."
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
If the incident status is chnaged to inprogress corresponding problem state is chnaged to in progresss.
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
(function executeRule(current, previous) {
// Check if the state changed to "In Progress"
if (current.state.changesTo(2)) { // Assuming 2 is the value for "In Progress"
var grProblem = new GlideRecord('problem');
grProblem.addQuery('incident', current.sys_id);
grProblem.query();
while (grProblem.next()) {
grProblem.state = 2; // Assuming 2 is the value for "Work in Progress"
grProblem.update();
}
}
})(current, previous);
Loading