Do a character count on the Resolution Notes before Resolving

josephd01
Mega Guru

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.

1 ACCEPTED SOLUTION

Hi @josephd01 

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

View solution in original post

5 REPLIES 5

Hi,

The first part of the script is working perfectly and it is all that I need . The second part of the script checking is not working, but I do not have a need for the questions to be removed. Thank you for providing an answer.

 

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