Skip to content

Commit 00436aa

Browse files
authored
Create readme.md
1 parent a5b97fc commit 00436aa

File tree

1 file changed

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

1 file changed

+67
-0
lines changed
Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
README — Client Script: Validate Interaction Resolution
2+
📌 Purpose
3+
This Client Script ensures proper validation when resolving an Interaction record in ServiceNow.
4+
It prevents a user from marking an Interaction as Closed Complete without proper justification.
5+
6+
🎯 What It Does
7+
8+
When a user attempts to submit the form:
9+
✔ Allows submission only if:
10+
Interaction Type is "walkup"
11+
And Related Task Boolean is true
12+
13+
OR
14+
✔ If work notes are provided for First Contact Resolution (FCR)
15+
❌ Prevents submission if:
16+
State = Closed Complete
17+
Work Notes are empty
18+
And no related task condition is met
19+
20+
🧠 Validations Performed
21+
Field Condition Action
22+
state closed_complete Trigger validation
23+
type walkup AND u_boolean_no_related_task = true Submission allowed ✅
24+
work_notes Must not be empty Show error & stop submission ❌
25+
🔔 User Feedback
26+
27+
If work notes are missing:
28+
Displays inline field message
29+
30+
Shows popup alert:
31+
"Provide Worknotes for FCR Interaction"
32+
33+
📍 Script Location
34+
35+
Client Script → Type: onSubmit()
36+
Applicable to Interaction table (interaction)
37+
38+
📌 Script Code
39+
//Client Script to validate an Interaction record is resolved with out any related record created.
40+
function onSubmit() {
41+
var relatedTask = g_form.getValue('u_boolean_no_related_task');
42+
var state = g_form.getValue('state');
43+
var type = g_form.getValue('type');
44+
var workNotes = g_form.getValue('work_notes'); // Get the value of work notes
45+
46+
// Clear previous field messages
47+
g_form.clearMessages();
48+
49+
// Check if state is changing to 'Closed Complete'
50+
if (state == 'closed_complete') {
51+
// Check additional conditions
52+
if (type == 'walkup' && relatedTask == 'true') {
53+
return true; // Allow form submission
54+
} else if (!workNotes) { // Check if work notes is empty
55+
g_form.showFieldMsg('work_notes', 'Provide Worknotes for FCR Interaction', 'error');
56+
alert('Provide Worknotes for FCR Interaction');
57+
return false; // Prevent form submission
58+
}
59+
}
60+
return true; // Allow form submission for other states
61+
}
62+
63+
✅ Benefits
64+
65+
Maintains consistent resolution standards
66+
Ensures justification/documentation for FCR interactions
67+
Reduces incorrect closure of requests without related actions

0 commit comments

Comments
 (0)