How to Add a Character Counter and Limit to Multi-line Text Field in Service Portal Catalog Item?

Domi727
Tera Contributor

Hi everyone,

I'm working on a catalog item in the Service Portal (ESC), and I need to implement a character counter for a multi-line text field.

Here’s what I’m trying to achieve:

  • Limit the input to 1000 characters.
  • Display a live character counter below or beside the field.
  • Automatically truncate any excess characters beyond the limit.

I’ve tried using some client scripts and UI policies, but I’m not sure how to best approach this in the context of the Service Portal. Ideally, I’d like a solution that works seamlessly with the portal widgets and doesn’t require heavy customization.

 

image.png

 

Has anyone implemented something similar? Any guidance, code snippets, or best practices would be greatly appreciated!

 

Thanks in advance!

2 REPLIES 2

Ankur Bawiskar
Tera Patron
Tera Patron

@Domi727 

You can use onChange catalog client script on that variable and achieve these but not the live count

  • Limit the input to 1000 characters. -> Yes
  • Display a live character counter below or beside the field. -> Check below link
  • Automatically truncate any excess characters beyond the limit. -> Yes

How to display counter for number of characters left on catalog item variable 

If my response helped please mark it correct and close the thread so that it benefits future readers.

Regards,
Ankur
Certified Technical Architect  ||  9x ServiceNow MVP  ||  ServiceNow Community Leader

ifti122
Tera Guru

Hi @Domi727 ,

To set input limit to 1000 characters you can refer to the following community post:

Solved: Set Character limit on Multi-line Variables - ServiceNow Community

 

To Display a live character counter below or beside the field, refer the following link:

Solved: How to display counter for number of characters le... - ServiceNow Community

 

Thanks & Regards,
Muhammad Iftikhar
If my response helped, please mark it as the accepted solution so others can benefit as well.