Enforce minimum characters on Additional comments field on SCTASK table
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2022 01:15 AM
How to make "Additional Comments" have a minimum character requirement upon the catalogue task being set to the "Closed Complete" state?
Basically what we are trying to do is ensure that the client communication that is sent out when the catalogue task is closed actually contains communication to the client rather than something like a period or ellipses and if they try to input less than the minimum, we would like an error message to come up to say something like "Please enter a minimum of 18 characters".
I have tried the OnChange client script & before update business rule but nothing seems to work.
Any help would be appreciated.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2022 01:31 AM
Hi
If you just want to alert your users to enter a minimum of 18 characters, then use what Justin has already said above.
If you want disabling of Form Submission in case there are less than 18 characters, the you can use the following BR:-
On Before Insert/Update:-
var ge = new GlideRecord('incident');
ge.addQuery('number', current.number);
ge.query();
if(ge.next())
{
if(ge.work_notes.toString().length<18)
{
gs.addErrorMessage('Your Message');
current.setAbortAction(true);
}}
Mark my answer correct & Helpful, if Applicable.
Thanks,
Sandeep
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2022 01:36 AM
Thanks, Sandeep for your response.
I am unable to see any comments from Justin and also this has to be done on service catalogue tasks, I have tried this and it doesn't work.
The field type here is a reference field sc_task.requested_item.comments
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2022 02:10 AM
Hi Suryansh,
Write a before update BR on catalog task table and use the below code
var comm = current.comments.getJournalEntry(1);
if(comm.toString().length() < 18){
gs.addErrorMessage('message');
current.setAbortAction(true);
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
04-01-2022 03:56 AM