From 0f500983f9132f388b1a41fda7641fbfc84fc69f Mon Sep 17 00:00:00 2001 From: anjimuvva <42597425+anjimuvva@users.noreply.github.com> Date: Fri, 10 Oct 2025 23:44:05 +0800 Subject: [PATCH 1/2] Create mandatory_subcategory.js --- .../mandatory_subcategory.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 Client-Side Components/Catalog Client Script/Mandatory Subcategory based on Category/mandatory_subcategory.js diff --git a/Client-Side Components/Catalog Client Script/Mandatory Subcategory based on Category/mandatory_subcategory.js b/Client-Side Components/Catalog Client Script/Mandatory Subcategory based on Category/mandatory_subcategory.js new file mode 100644 index 0000000000..094b966be3 --- /dev/null +++ b/Client-Side Components/Catalog Client Script/Mandatory Subcategory based on Category/mandatory_subcategory.js @@ -0,0 +1,17 @@ +// Type: onChange +// Table: incident +// Field: category +function onChange(control, oldValue, newValue, isLoading) { + if (isLoading || newValue == '') { + return; + } + + // Make subcategory mandatory when category is selected + if (newValue=="") { + g_form.setMandatory('subcategory', true); + g_form.showFieldMsg('subcategory', 'Please select a subcategory', 'info'); + } else { + g_form.setMandatory('subcategory', false); + g_form.hideFieldMsg('subcategory'); + } +} From c6409097c1dcfb03e701c52d3f87c328545c08b8 Mon Sep 17 00:00:00 2001 From: anjimuvva <42597425+anjimuvva@users.noreply.github.com> Date: Fri, 10 Oct 2025 23:50:14 +0800 Subject: [PATCH 2/2] Create README.md --- .../README.md | 14 ++++++++++++++ 1 file changed, 14 insertions(+) create mode 100644 Client-Side Components/Catalog Client Script/Mandatory Subcategory based on Category/README.md diff --git a/Client-Side Components/Catalog Client Script/Mandatory Subcategory based on Category/README.md b/Client-Side Components/Catalog Client Script/Mandatory Subcategory based on Category/README.md new file mode 100644 index 0000000000..ff62b69127 --- /dev/null +++ b/Client-Side Components/Catalog Client Script/Mandatory Subcategory based on Category/README.md @@ -0,0 +1,14 @@ +Client Script: Make Subcategory Mandatory Based on Category + +Overview: +This client script ensures that the Subcategory field becomes mandatory when a Category is selected on the Incident form. + +Implementation Details: + +Create a new Client Script with the following configuration: + +Type: OnChange +Table: incident +Field: category + +Add the provided script in the file mandatory_subcategory.js.