From a75b4424580497162c39986859938ba039e458bd Mon Sep 17 00:00:00 2001 From: MANCHALA YASWANTH <71426465+MYaswanth28@users.noreply.github.com> Date: Fri, 17 Oct 2025 15:43:51 +0530 Subject: [PATCH 1/4] Create character_counter.js --- .../character_counter.js | 31 +++++++++++++++++++ 1 file changed, 31 insertions(+) create mode 100644 Client-Side Components/Client Scripts/Live Character Counter and Validator/character_counter.js diff --git a/Client-Side Components/Client Scripts/Live Character Counter and Validator/character_counter.js b/Client-Side Components/Client Scripts/Live Character Counter and Validator/character_counter.js new file mode 100644 index 0000000000..1c4295b740 --- /dev/null +++ b/Client-Side Components/Client Scripts/Live Character Counter and Validator/character_counter.js @@ -0,0 +1,31 @@ +function onChange(control, oldValue, newValue, isLoading, isTemplate) { + + var FIELD_NAME = 'short_description'; + var MAX_CHARS = 100; + var currentLength = newValue.length; + var counterId = FIELD_NAME + '_counter_label'; + if (typeof g_form.getControl(FIELD_NAME) !== 'undefined' && !document.getElementById(counterId)) { + var controlElement = g_form.getControl(FIELD_NAME); + var counterLabel = document.createElement('div'); + counterLabel.setAttribute('id', counterId); + counterLabel.style.fontSize = '85%'; + counterLabel.style.marginTop = '2px'; + controlElement.parentNode.insertBefore(counterLabel, controlElement.nextSibling); + } + var counterElement = document.getElementById(counterId); + + if (counterElement) { + var remaining = MAX_CHARS - currentLength; + + + counterElement.innerHTML = 'Characters remaining: ' + remaining + ' (Max: ' + MAX_CHARS + ')'; + + // Apply red color if the limit is exceeded + if (remaining < 0) { + counterElement.style.color = 'red'; + } else { + // Revert color if back within limits + counterElement.style.color = 'inherit'; + } + } +} From 5ac96053013184ab1d8c28703d23fd84b9a0dcc9 Mon Sep 17 00:00:00 2001 From: MANCHALA YASWANTH <71426465+MYaswanth28@users.noreply.github.com> Date: Fri, 17 Oct 2025 15:44:31 +0530 Subject: [PATCH 2/4] Create README.md --- .../Live Character Counter and Validator/README.md | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 Client-Side Components/Client Scripts/Live Character Counter and Validator/README.md diff --git a/Client-Side Components/Client Scripts/Live Character Counter and Validator/README.md b/Client-Side Components/Client Scripts/Live Character Counter and Validator/README.md new file mode 100644 index 0000000000..d03d21e990 --- /dev/null +++ b/Client-Side Components/Client Scripts/Live Character Counter and Validator/README.md @@ -0,0 +1,4 @@ +This solution dynamically provides users with real-time feedback on the length of a text input field (like short_description or a single-line text variable). +It immediately displays a character count beneath the field and uses visual cues to indicate when a pre-defined character limit has been reached or exceeded. + +This is a vital User Experience (UX) enhancement that helps agents and users write concise, actionable information, leading to improved data quality and better integration reliability. From de12c8d1cf7bebb7087c3b703618c1b9a7073229 Mon Sep 17 00:00:00 2001 From: MANCHALA YASWANTH <71426465+MYaswanth28@users.noreply.github.com> Date: Fri, 17 Oct 2025 17:37:34 +0530 Subject: [PATCH 3/4] Update README.md --- .../Live Character Counter and Validator/README.md | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/Client-Side Components/Client Scripts/Live Character Counter and Validator/README.md b/Client-Side Components/Client Scripts/Live Character Counter and Validator/README.md index d03d21e990..1ebf4b75fe 100644 --- a/Client-Side Components/Client Scripts/Live Character Counter and Validator/README.md +++ b/Client-Side Components/Client Scripts/Live Character Counter and Validator/README.md @@ -2,3 +2,9 @@ This solution dynamically provides users with real-time feedback on the length o It immediately displays a character count beneath the field and uses visual cues to indicate when a pre-defined character limit has been reached or exceeded. This is a vital User Experience (UX) enhancement that helps agents and users write concise, actionable information, leading to improved data quality and better integration reliability. + +Name Live_Character_Counter_ShortDesc_OnLoad +Table : Custom Table or Incident +Type onLoad +UI Type All +Isolate Script false From 329b25e8301bb6a1314567a47df851908b86332b Mon Sep 17 00:00:00 2001 From: MANCHALA YASWANTH <71426465+MYaswanth28@users.noreply.github.com> Date: Fri, 17 Oct 2025 17:40:15 +0530 Subject: [PATCH 4/4] Update README.md --- .../Live Character Counter and Validator/README.md | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/Client-Side Components/Client Scripts/Live Character Counter and Validator/README.md b/Client-Side Components/Client Scripts/Live Character Counter and Validator/README.md index 1ebf4b75fe..24c529a6cc 100644 --- a/Client-Side Components/Client Scripts/Live Character Counter and Validator/README.md +++ b/Client-Side Components/Client Scripts/Live Character Counter and Validator/README.md @@ -5,6 +5,7 @@ This is a vital User Experience (UX) enhancement that helps agents and users wri Name Live_Character_Counter_ShortDesc_OnLoad Table : Custom Table or Incident -Type onLoad +Type onChange +Field : Description UI Type All Isolate Script false