Set close notes and close codes as mandatory while closing/resolving the incident in client script

sivaiah
Kilo Contributor

Set close notes and close codes as mandatory while closing/resolving the incident in client script

4 REPLIES 4

Ankur Bawiskar
Tera Patron
Tera Patron

Hi,

already happening OOB on incident table via Data Policy

what is required then?

find_real_file.png

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

@sivaiah 

Hope you are doing good.

Did my reply answer your question?

If my response helped please close the thread by marking appropriate response as correct so that it benefits future readers.

Regards
Ankur

 

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader

Community Alums
Not applicable

Hi @sivaiah ,

Close codes and close notes are set as mandatory in closed and resolved state by default in OOB instances.

other ways are either you can create an UI policy with condition State is Resolved and add UI Policy Actions that make Close codes and Close Notes Mandatory.

Or you can also write an OnChange client script on the state field :

function onChange(control, oldValue, newValue, isLoading, isTemplate) {
   if (isLoading || newValue === '') {
      return;
   }
if(state == '6')
	{
		g_form.setMandatory('close_code',true);
		g_form.setMandatory('close_notes',true);
	} 
	else
		{
			g_form.setMandatory('close_code',false);
			g_form.setMandatory('close_notes',false);
		}
}

Mark my answer correct & Helpful, if Applicable.

Thanks,

Sandeep

Since there is already OOB Data policy which works as UI policy on form as well; so there won't be any need to create client script.

Regards
Ankur

Regards,
Ankur
✨ Certified Technical Architect  ||  ✨ 9x ServiceNow MVP  ||  ✨ ServiceNow Community Leader