Cannot set "Additional Comments" mandatory

Felipe Morais
Tera Contributor

I am trying to set Additional Comments as mandatory for my incidents when state is "Resolved".  When I use the button Resolve it works as supposed, but when i select the "Resolved" state from the choice list is doesn't.

I tried using UI Policies and Client Scripts to set the field as mandatory with the following script:

FelipeMorais_0-1700155256338.png

This is the same code snipplet used in the UI Action Button "Resolve", which works as i said. So i don't understand why this doesn't work.

I already check for other UI Policies/Client Scripts applied to the same field, but none of them seems to be overwriting my rule. I also tried the same things with the "worknotes_and_comments" field*, but it did not work.

*Since the comments and  worknotes fields can be "united" using Show One Journal Field button

FelipeMorais_2-1700155944022.png


Is there another way that i can define a rule to set this field as mandatory following this condition?

1 REPLY 1

Brad Bowman
Kilo Patron
Kilo Patron

It would be helpful to post the entire script, as the issue may lie in the lines preceding this one. I assume you're running this onChange of the State field.  You can also add alert lines to your script to ensure it's running, and if any IF conditions are being met.  We're using this script to make Additional comments mandatory when the On hold reason changes to Awaiting Caller:

 

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