- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2017 10:15 AM
I would like to limit the number of characters entered in the Short Description field on the Incident form. Here's what I've tried:
Within the Form Designer, in the Short Description field properties (accessed by clicking the gear icon), there is an option for "Max Length." I have modified this to a more desirable number, e.g. 100, and saved the form. After reloading the form, it appears that this value has been reset to the 255 value. Why does this not accept the change? I imagine this can be accomplished by some client-side javascript although I am a new SNow admin. What are my options?
I hesitate modifying the data dictionary on the field in the database due to data loss.
Solved! Go to Solution.
- Labels:
-
Incident Management
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-20-2017 06:29 AM
Hey Brian,
Just switch the order of the functions, first setValue, then showFieldMessage .
Two advices, before the if statement do a hideFieldMessage to remove the text in case the user used less than 80 characters. The other one is to use info instead of error. You will be trimming the description, that means that the user can continue with his work. I don't like leaving red messages if the user doesn't need to modify anything.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2017 10:30 AM
Hi Brian,
You can reduce the max length of 'Short Description' field by changing it in 'Data Dictionary' but this would lead to loss of data wherever 'Short Description' field from Task table is used and have a length more than 100.
Thanks,
Manik
PS- mark helpful, like and correct if it solves your problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2017 10:32 AM
I don't want to alter the data dictionary for all fields that reference that field on the task table. That would be a nuclear option. Is that my only choice?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2017 10:41 AM
Hi Brian,
Yes that would be the only option to restrict the limit in Short Description field would be by changing the length in Dictionary field else you can write a onSubmit client script to restrict the user from entering the short description of length more that 100.
Client Script:
Thanks,
Manik
PS- mark helpful, like and correct if it solves your problem
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎07-19-2017 12:20 PM
I would much prefer when the maximum number of characters is exceeded, input is blocked, and a pop up notification is presented. This notification would notify them that they've exceeded the maximum allowable number of characters in that field. I've tried myself, except it doesn't appear to be working:
Sounds like that should be possible in an onChange event. Although, the API states that it only works on a "widget," is a "widget" a field on a form?