Skip to content
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
📘 README — Auto Update Resolution SLA on Related Tasks
Business Rule Details

Name: Auto Update Resolution SLA Reference
Table: task_sla
Execution: After Insert
Filter Condition: SLA Definition target must be Resolution
Condition: Runs only when the associated task is an Incident or a Catalog Task
(current.task.sys_class_name == 'incident' || current.task.sys_class_name == 'sc_task')

Purpose

This Business Rule is designed to automatically update the related Incident and Task records with the Resolution SLA reference when a new Task SLA record is created.
It helps provide direct visibility of SLA details from the Incident or Task form without navigating to the task_sla table.

How It Works

A new Resolution SLA is created for a task.

This rule triggers after the Task SLA record is inserted.

It checks if the related task is an Incident or a Catalog Task.

It updates the custom SLA reference fields on both the Incident and the Task.

Prerequisites

You must create the following fields before using this rule:

Field: u_resolution_sla (On Incident table)
Type: Reference to task_sla

Field: u_task_resolution_sla (On Task table)
Type: Reference to task_sla

Testing Steps

• Create a new Incident and associate a Resolution SLA with it.
• Allow the SLA to start (so it creates a task_sla entry).
• Open the Incident and related Task.
• You should see the Resolution SLA reference auto-populated in both.

Script Used
(function executeRule(current, previous /*null when async*/ ) {

var inc = new GlideRecord('incident');
inc.get(current.task);

inc.u_resolution_sla = current.sys_id;
inc.update();

var tsk = new GlideRecord('task');
tsk.get(current.task);

tsk.u_task_resolution_sla = current.sys_id;
tsk.update();

})(current, previous);

Result

This automation ensures the SLA is visible and reportable on both Incident and Task records with no manual updates.
It improves SLA tracking, reporting, and overall usability.
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
// Business Rule: Set Resolution SLA on Related Tasks
// Table: task_sla
// When: After Insert

// PURPOSE:
// When a new Task SLA is created for Resolution SLA, update the related records.

// CONDITIONS:
// SLA Definition target = "Resolution"
// Run only if task is Incident or SC Task
// (current.task.sys_class_name == 'incident' || current.task.sys_class_name == 'sc_task')

// STEP 1:
// Get the related Incident record from current.task reference
var inc = new GlideRecord('incident'); // Query Incident table
inc.get(current.task); // Fetch the matching incident record

// Update Incident’s custom field to store the Resolution SLA reference
inc.u_resolution_sla = current.sys_id; // Set current task_sla sys_id
inc.update(); // Save changes to Incident

// STEP 2:
// Get the related Task record from current.task reference
var tsk = new GlideRecord('task'); // Query Task table
tsk.get(current.task); // Fetch the task (incident/sc_task/etc.)

// Update Task’s custom field to store the Resolution SLA reference
tsk.u_task_resolution_sla = current.sys_id; // Set current task_sla sys_id
tsk.update(); // Save changes to Task
Loading