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

Enforce minimum length on close notes field?

joshuamayes
Giga Expert

We thought it would be a good idea to make close notes mandatory when the ITIL user marks and incident as resolved.

Unfortunately this has resulted in them just typing stuff like "Fixed" or "Done" or "Complete" in the field.

Is there a way to make a minimum length attribute on the field so that the workers are forced to write more descriptive answers?

1 ACCEPTED SOLUTION

Deepak Kumar5
Kilo Sage

Wrtie onChange script.



var myFieldValue = g_form.getValue('Field_name');        


      if (myFieldValue.toString().length < 6) { // or whatever number you want      


              g_form.setValue('field_name','');        


              alert('Please enter 6 or more characters.');        


      }  


View solution in original post

4 REPLIES 4

Deepak Kumar5
Kilo Sage

Wrtie onChange script.



var myFieldValue = g_form.getValue('Field_name');        


      if (myFieldValue.toString().length < 6) { // or whatever number you want      


              g_form.setValue('field_name','');        


              alert('Please enter 6 or more characters.');        


      }  


Thank you, that's definitely on the right track.   Before I go and start testing, do you mind explaining what the line "g_form.setValue();" does?


That sets the value to the field. In the above code by Deep it's actually clearing the field value to null.


this script is running for every character I enter in work notes. But my requirement is to validate the length of work notes should not be less than 25 chars