diff --git a/Client-Side Components/Client Scripts/Conditional Auto-Routing and Dynamic Mandatory Fields/Conditional_AutoRouting_Dynamic_Mandatory_Fields.js b/Client-Side Components/Client Scripts/Conditional Auto-Routing and Dynamic Mandatory Fields/Conditional_AutoRouting_Dynamic_Mandatory_Fields.js new file mode 100644 index 0000000000..b93bdf08d0 --- /dev/null +++ b/Client-Side Components/Client Scripts/Conditional Auto-Routing and Dynamic Mandatory Fields/Conditional_AutoRouting_Dynamic_Mandatory_Fields.js @@ -0,0 +1,16 @@ +function onChange(control, oldValue, newValue, isLoading) { + if (isLoading) return; + + if (newValue === 'hardware') { + g_form.setMandatory('asset_tag', true); + g_form.setDisplay('asset_tag', true); + g_form.setValue('assignment_group', 'Hardware Support Group'); + } else if (newValue === 'software') { + g_form.setMandatory('asset_tag', false); + g_form.setDisplay('asset_tag', false); + g_form.setValue('assignment_group', 'Software Support Group'); + } else { + g_form.setMandatory('asset_tag', false); + g_form.setDisplay('asset_tag', true); + } +} diff --git a/Client-Side Components/Client Scripts/Conditional Auto-Routing and Dynamic Mandatory Fields/Readme.md b/Client-Side Components/Client Scripts/Conditional Auto-Routing and Dynamic Mandatory Fields/Readme.md new file mode 100644 index 0000000000..d073b7d0e8 --- /dev/null +++ b/Client-Side Components/Client Scripts/Conditional Auto-Routing and Dynamic Mandatory Fields/Readme.md @@ -0,0 +1,2 @@ +If an Incident Category = Hardware, make Asset Tag mandatory and automatically assign to Hardware Support Group. +If Software, assign to Software Support Group and hide Asset Tag.