Client Scripts
Reject Whitespace-only Incident Summaries
Prevent incident form submission when Short description is empty or contains only whitespace, without changing the text entered by the user.
function onSubmit() {
var summary = g_form.getValue('short_description') || '';
if (!/\S/.test(summary)) {
g_form.addErrorMessage('Enter a meaningful Short description before saving.');
return false;
}
return true;
}How to use it
1. Create an active onSubmit Client Script on the Incident [incident] table. 2. Set UI Type to Desktop for a classic platform form and paste the script. 3. Test an empty value, spaces, tabs, and line breaks: submission should be blocked. Test a normal summary and text with surrounding spaces: submission should be allowed and the original text preserved. Existing mandatory-field validation may run first. 4. This checks for at least one non-whitespace character, not the quality of the summary. Punctuation and invisible non-whitespace characters are not rejected. 5. This is client-side feedback only. Imports, REST calls, and other server-side writes bypass it; add server-side validation if this must be an enforced data rule. UI Builder pages do not run classic Client Scripts. 6. To roll back, deactivate this Client Script. No existing incident data is modified.
Adapt the table names, fields, and conditions to your instance. Test the behavior in a development environment before using it in production.