The Zurich release has arrived! Interested in new features and functionalities? Click here for more

Minimum character requirement in Additional Comments and Close Notes upon resolve

apassey
Kilo Explorer

Would someone be able to help point me in the right direction on how to make "Additional Comments" and "Close Notes" have a minimum character requirement upon an Incident being set to the "Resolved" state?  

 

Basically what we are trying to do is ensure that the client communication that is sent out when an incident is resolved actually contains a 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". We would like the close notes to contain valid information as well.

 

Thank you!

April

9 REPLIES 9

justin_drysdale
Mega Guru

Quick example from the client side:



var field_to_test = g_form.getValue('some_variable_to_length_test');


if ( field_to_test.length < 18 ) {


  alert("Please enter a minimum of 18 characters.");


}


Subhajit1
Giga Guru

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


}


}


harikrish_v
Mega Guru

Since you have mentioned that you need to display an error message, you can put the below code in a Before Update business rule or inside your Save/Update button(whatever you use on your form):-



if(current.comments.toString().length<18){


gs.addInfoMessage('Please enter a min of 18 characters');


current.setAbortAction(true);


}


You can use the same thing for Close Notes, just replace 'comments' with 'close_notes'.



Hope this helps



Thanks & Regards,


Hari


rc26
Tera Contributor

After entering the work notes and clicking on POST button it is not posting the work notes which is expected but the error message is not getting displayed on form.