Join the #BuildWithBuildAgent Challenge! Get recognized, earn exclusive swag, and inspire the ServiceNow Community with what you can build using Build Agent.  Join the Challenge.

How to set Additional Comments field mandatory to fill, whenever incident moved to canceled state.

Community Alums
Not applicable

I have the following requirement:

Whenever an incident is moved to cancelled state, Additional Comments [comments] field should be mandatory to fill.

 

HrishabhKumar_0-1743771035120.png

 

HrishabhKumar_1-1743771097873.png

 

Let me know how it could be done, Thanks.

12 REPLIES 12

@Community Alums 

for your below requirement why won't before update BR won't help?

Whenever an incident is moved to cancelled state, Additional Comments [comments] field should be mandatory to fill.

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

@HrishabhKumar 

Hope you are doing good.

Did my reply answer your question?

If my response helped please mark it correct and close the thread so that it benefits future readers.

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

Simran Gadodiya
Mega Sage

Hi @Community Alums 

You can try onChange Client Script when the State changes:

 

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

 

If this resolve your problem please mark it as helpful and accept the solution.

Thank You!