Skip to content

Commit a5b97fc

Browse files
authored
Create script.js
1 parent 4533870 commit a5b97fc

File tree

1 file changed

+29
-0
lines changed
  • Client-Side Components/Client Scripts/validate Interaction if it is an FCR(First Call Resolution)

1 file changed

+29
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Business Rule: Set Resolution SLA on Related Tasks
2+
// Table: task_sla
3+
// When: After Insert
4+
5+
// PURPOSE:
6+
// When a new Task SLA is created for Resolution SLA, update the related records.
7+
8+
// CONDITIONS:
9+
// SLA Definition target = "Resolution"
10+
// Run only if task is Incident or SC Task
11+
// (current.task.sys_class_name == 'incident' || current.task.sys_class_name == 'sc_task')
12+
13+
// STEP 1:
14+
// Get the related Incident record from current.task reference
15+
var inc = new GlideRecord('incident'); // Query Incident table
16+
inc.get(current.task); // Fetch the matching incident record
17+
18+
// Update Incident’s custom field to store the Resolution SLA reference
19+
inc.u_resolution_sla = current.sys_id; // Set current task_sla sys_id
20+
inc.update(); // Save changes to Incident
21+
22+
// STEP 2:
23+
// Get the related Task record from current.task reference
24+
var tsk = new GlideRecord('task'); // Query Task table
25+
tsk.get(current.task); // Fetch the task (incident/sc_task/etc.)
26+
27+
// Update Task’s custom field to store the Resolution SLA reference
28+
tsk.u_task_resolution_sla = current.sys_id; // Set current task_sla sys_id
29+
tsk.update(); // Save changes to Task

0 commit comments

Comments
 (0)