Skip to content

Commit 3f59723

Browse files
authored
Create script.js
1 parent 21b615f commit 3f59723

File tree

1 file changed

+24
-0
lines changed
  • Client Scripts/validate Interaction record

1 file changed

+24
-0
lines changed
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
2+
//Client Script to validate an Interaction record is resolved with out any related record created.
3+
function onSubmit() {
4+
var relatedTask = g_form.getValue('u_boolean_no_related_task');
5+
var state = g_form.getValue('state');
6+
var type = g_form.getValue('type');
7+
var workNotes = g_form.getValue('work_notes'); // Get the value of work notes
8+
9+
// Clear previous field messages
10+
g_form.clearMessages();
11+
12+
// Check if state is changing to 'Closed Complete'
13+
if (state == 'closed_complete') {
14+
// Check additional conditions
15+
if (type == 'walkup' && relatedTask == 'true') {
16+
return true; // Allow form submission
17+
} else if (!workNotes) { // Check if work notes is empty
18+
g_form.showFieldMsg('work_notes', 'Provide Worknotes for FCR Interaction', 'error');
19+
alert('Provide Worknotes for FCR Interaction');
20+
return false; // Prevent form submission
21+
}
22+
}
23+
return true; // Allow form submission for other states
24+
}

0 commit comments

Comments
 (0)