Enforce minimum characters on Additional comments field on SCTASK table

Suryansh Verma
Tera Contributor

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.

find_real_file.png

5 REPLIES 5

Community Alums
Not applicable

Hi @Suryansh Verma ,

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

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

Vishnu Prasad K
Giga Guru

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);

}

Hi Vishnu,

It doesn't work either, it's letting me update with one word only

 

find_real_file.png