- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2016 08:32 AM
By default, work_notes has a max length of 4000, but it doesn't work.
I've tried making it work by getting control with g_form.getControl, but that doesn't work either.
var w = g_form.getControl('work_notes');
if (w)
w.setAttribute("maxlength", 1000);
I've tried it with both an onLoad, and onChange. Nothing is able to restrict it.
Initially, I thought it might have been related to the additional container that work_notes and additional_comments are grouped in (starting with Geneva), but I tested it in Fuji as well, and it is a problem across the board.
The reason I need this is because we built an custom table that extends task (hence the work_notes), and they send information from this table to a vendor. The vendor only accepts 1000 characters.
Any suggestions?
Solved! Go to Solution.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2016 08:47 AM
Hi Simon,
You can write a onSubmit Client script for validation. Here you go.
function onSubmit()
{
var wnote = g_form.getValue('work_notes');
if(wnote.length > 1000)
{
alert('YOUR MESSAGE')
return false;
}
}

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2016 09:02 AM
Hi Sourabh,
Just so you are aware DOM manipulation (document.getElementByID is included) is not supported by ServiceNow and may cause issues between releases.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2016 09:10 AM
Thanks Chuck,
But there are cases where we have used such manipulation.
eg. When one want to add a number of desktop requests in one single request. Every time the desktop number may change.
We have used it as a last option.
Kind regards,
Sourabh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
07-27-2016 09:11 AM
Thanks all for the quick feedback
I think I'll just go with the onSubmit to check the length.