Skip to content

Commit bb0ae94

Browse files
authored
Validate an Interaction record to check if that is a FCR(First Call Resolution) (#2609)
* Code for Moveworks bot messages for Flow to include url links * Create script.js * Create readme.md * Delete Client Scripts/validate Interaction record/readme.md * Delete Moveworks messages html for Flow * Create readme.md * Create script.js * Create readme.md * Delete Client Scripts/validate Interaction record/readme.md * Delete Client Scripts/validate Interaction record/script.js * Create script.js * Create readme.md * Update script.js * Create script.js * Create readme.md * Delete Server-Side Components/Business Rules/Auto-assignment based on variable selection in catalog/readme.md * Delete Server-Side Components/Business Rules/Auto-assignment based on variable selection in catalog/script.js * Delete Client-Side Components/Client Scripts/validate Interaction if it is an FCR(First Call Resolution)/readme.md * Delete Client-Side Components/Client Scripts/validate Interaction if it is an FCR(First Call Resolution)/script.js
1 parent 54f39ce commit bb0ae94

File tree

2 files changed

+94
-0
lines changed
  • Client-Side Components/Client Scripts/Validate Interaction record for FCR(First Call Resolution)

2 files changed

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

0 commit comments

Comments
 (0)