- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2022 05:32 AM
Hi All,
I have requirement to set a default question list for the resolution notes and then doing a character count before the incident is resolved.
The default questions on the resolve notes are to be set as :
Who resolved the call?
What was done to resolve the call?
Who verified that it is now working?
When the Incident gets resolved it should not have less than 150 characters and should not be the default value to ensure that the agents update the resolution. I found the below script on the community posts.
https://community.servicenow.com/community?id=community_question&sys_id=7f8d5510db7ab810770be6be13961975
This works great if there is no value in the Resolution notes. Is there a way for me to do this? I have not been able to find a solution.
Solved! Go to Solution.
- Labels:
-
Incident Management

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2022 04:14 AM
Hi
Try writing an onSubmit client script as below and check if its working
function onSubmit() {
var state = g_form.getValue('state');
if(state == '6')
{
if(g_form.getValue('close_notes').toString().length < 150)
{
g_form.showErrorBox('close_notes',"Please enter minimum 150 characters");
return false;
}
}
var notes = g_form.getValue('close_notes').toString();
if((notes.indexOf('Who resolved the call?') == -1) || (notes.indexOf('What was done to resolve the call?') == -1) || (notes.indexOf('Who verified that it is now working?') == -1) )
{
g_form.showErrorBox('close_notes',"Existing value in resolution notes cannot be removed");
return false;
}
}
Mark as correct and helpful if it works.
Regards,
Sumanth

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2022 05:45 AM
Hi
Try this onChange client script on resolution notes field.
function onChange(Control, oldValue, newValue, isLoading) {
if (isLoading || newValue == "") {
return;
}
}
if (newValue.toString().length < 150) {
g_form.setValue('close_notes','');
alert('Length cannot be less than 150');
}
Mark as correct or helpful if it works.
Regards,
Sumanth
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2022 08:04 AM
Did you try the above code?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-09-2022 11:44 PM
Good Morning,
The issue that I am having is that there is a default value(Set of Questions) that already occupies the field. I need some way to check that the default value was not left without being updated. The solution provided is indeed helpful if there is no value within the field already.
This check only needs to be done when the incident gets resolved.

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
05-10-2022 04:14 AM
Hi
Try writing an onSubmit client script as below and check if its working
function onSubmit() {
var state = g_form.getValue('state');
if(state == '6')
{
if(g_form.getValue('close_notes').toString().length < 150)
{
g_form.showErrorBox('close_notes',"Please enter minimum 150 characters");
return false;
}
}
var notes = g_form.getValue('close_notes').toString();
if((notes.indexOf('Who resolved the call?') == -1) || (notes.indexOf('What was done to resolve the call?') == -1) || (notes.indexOf('Who verified that it is now working?') == -1) )
{
g_form.showErrorBox('close_notes',"Existing value in resolution notes cannot be removed");
return false;
}
}
Mark as correct and helpful if it works.
Regards,
Sumanth