limit single line text variable in RP form to 255 char
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-24-2023 11:55 PM
hi, we have a requirement to limit one Record producer text field variable chrarcter limit to 255 char , please help me in this issue.
Thanks in advance
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 01:32 AM
Hi @Amit Dey1
Let's try a simple OnChange Script.
function onChange(control, oldValue, newValue, isLoading) {
if (isLoading || newValue == '') {
return;
}
if(newValue.length >= 255){
g_form.showFieldMsg('short_description', 'Maximum 255 characters', 'error');
}
}
Or you can simply define a help text in Annotation.
Cheers,
Tai Vu

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 01:40 AM
The onChange script only works when the user moves out of the field.
I would go for an annotation to indicate the max amount.
Help others to find a correct solution by marking the appropriate response as accepted solution and helpful.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
10-25-2023 01:45 AM
for that you need onChange but as mentioned by Peter it would work only when user clicks somewhere outside the variable
Ankur
✨ Certified Technical Architect || ✨ 9x ServiceNow MVP || ✨ ServiceNow Community Leader