From 23c19b3b0f56163da0daca2a5b96e25f3526c674 Mon Sep 17 00:00:00 2001 From: Harshal Patel <100208298+harshal045@users.noreply.github.com> Date: Sat, 11 Oct 2025 14:08:21 +0530 Subject: [PATCH 1/2] Create script.js --- .../script.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) create mode 100644 Client-Side Components/Client Scripts/Warn Before Closing Incident Without Work Notes/script.js diff --git a/Client-Side Components/Client Scripts/Warn Before Closing Incident Without Work Notes/script.js b/Client-Side Components/Client Scripts/Warn Before Closing Incident Without Work Notes/script.js new file mode 100644 index 0000000000..40b4751222 --- /dev/null +++ b/Client-Side Components/Client Scripts/Warn Before Closing Incident Without Work Notes/script.js @@ -0,0 +1,12 @@ +function onSubmit() { + var state = g_form.getValue('state'); + var workNotes = g_form.getValue('work_notes'); + + // Check if state is Resolved (6) or Closed (7) and work notes are empty + if ((state == '6' || state == '7') && !workNotes.trim()) { + alert("Please add work notes before resolving or closing the Incident."); + return false; // Prevent form submission + } + + return true; // Allow submission +} From 16a7d4376a5f8b3d6036716e732c65c28938405a Mon Sep 17 00:00:00 2001 From: Harshal Patel <100208298+harshal045@users.noreply.github.com> Date: Sat, 11 Oct 2025 14:10:37 +0530 Subject: [PATCH 2/2] Create README.md Created a README file --- .../README.md | 32 +++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 Client-Side Components/Client Scripts/Warn Before Closing Incident Without Work Notes/README.md diff --git a/Client-Side Components/Client Scripts/Warn Before Closing Incident Without Work Notes/README.md b/Client-Side Components/Client Scripts/Warn Before Closing Incident Without Work Notes/README.md new file mode 100644 index 0000000000..409edfd2c2 --- /dev/null +++ b/Client-Side Components/Client Scripts/Warn Before Closing Incident Without Work Notes/README.md @@ -0,0 +1,32 @@ +# Warn Before Closing Incident Without Work Notes + +## Overview +This Client Script prevents users from resolving or closing an Incident without adding work notes. It ensures that important resolution details are documented before the ticket is closed. + +## Features +- Triggered on form submission. +- Checks if the Incident state is set to Resolved or Closed. +- Displays a warning if Work Notes are empty. +- Prevents form submission until notes are added. + +## Configuration + +- **Table**: `incident` +- **Type**: `onSubmit` +- **Script Name**: `Warn Before Closing Without Work Notes` +- **Active**: `true` + +## Script + + +function onSubmit() { + var state = g_form.getValue('state'); + var workNotes = g_form.getValue('work_notes'); + + if ((state == '6' || state == '7') && !workNotes.trim()) { + alert("Please add work notes before resolving or closing the Incident."); + return false; + } + + return true; +}