Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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.
Original file line number Diff line number Diff line change
@@ -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=="<category_name>") {
g_form.setMandatory('subcategory', true);
g_form.showFieldMsg('subcategory', 'Please select a subcategory', 'info');
} else {
g_form.setMandatory('subcategory', false);
g_form.hideFieldMsg('subcategory');
}
}
Loading