Skip to content

Commit a1d5fd8

Browse files
Uploading ServiceNow Js file
Conditional Auto-Routing and Dynamic Mandatory Fields
1 parent 8a1d0e4 commit a1d5fd8

File tree

1 file changed

+16
-0
lines changed

1 file changed

+16
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
function onChange(control, oldValue, newValue, isLoading) {
2+
if (isLoading) return;
3+
4+
if (newValue === 'hardware') {
5+
g_form.setMandatory('asset_tag', true);
6+
g_form.setDisplay('asset_tag', true);
7+
g_form.setValue('assignment_group', 'Hardware Support Group');
8+
} else if (newValue === 'software') {
9+
g_form.setMandatory('asset_tag', false);
10+
g_form.setDisplay('asset_tag', false);
11+
g_form.setValue('assignment_group', 'Software Support Group');
12+
} else {
13+
g_form.setMandatory('asset_tag', false);
14+
g_form.setDisplay('asset_tag', true);
15+
}
16+
}

0 commit comments

Comments
 (0)