- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2017 09:12 AM
Hi,
I have got a requirement wherein the short description field in Incident form should be limited to 80 characters.
User who is typing should be able to type only 80 characters and when he/she types the 81st character, an error message should be displayed and not allow to type more.
Please help me with this. Thanks in advance!!!
Regards,
Gopi
Solved! Go to Solution.
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2017 09:30 AM
I think, it has to be with onChange() client script, when user enters the value and move out of the field then it can display a message and also, we can set the length of the field to 80
- if (newValue.toString().length > 80) {
- g_form.setValue('short_description', newValue.substring(0,79));
- alert('Please enter 80 or less characters.');
- }

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2017 09:30 AM
I think, it has to be with onChange() client script, when user enters the value and move out of the field then it can display a message and also, we can set the length of the field to 80
- if (newValue.toString().length > 80) {
- g_form.setValue('short_description', newValue.substring(0,79));
- alert('Please enter 80 or less characters.');
- }
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2017 11:04 AM
Thanks Shishir....this worked for me
Thanks a lot!!!

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-11-2017 11:09 AM
Thank you Gopi,
Please mark my response as correct so that others with the same question in the future can find it quickly and that it gets removed from the Unanswered list. https://community.servicenow.com/docs/DOC-5601

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-10-2017 09:30 AM
I've seen on previous customer instances (I don't have the code anymore) where an onChange Client Script calculated the length of the field, and if it was greater than 80 chars, it would trim it back to the first 80.
Note: This won't work when editing the short_description in List View.
Jarod