Minimum character requirement in Additional Comments and Close Notes upon resolve
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2014 03:19 PM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-11-2014 03:55 PM
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.");
}
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2014 12:46 AM
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 as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
06-12-2014 01:34 AM
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
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2024 10:12 PM
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.