Make field mandatory after submitting (incident)

Snow Tomcal
Tera Expert

Hi All,

I have a field on the incident record that I want to make mandatory on form submitting.

I created a client script (onSubmit):

function onSubmit(){

g_form.setMandatory('field_name', true);

}

when I'm submitting it's turning to mandatory but after a few seconds the red asterisk disappears.

Does anyone know how to fix this?

 

Thanks 

 

7 REPLIES 7

Gunjan Kiratkar
Kilo Patron
Kilo Patron

Hi @Snow Tomcal ,

You can use onload client script as below. Change your field backend name 

function onLoad() {
   //Type appropriate comment here, and begin script below
	if(!g_form.isNewRecord()){
		g_form.setMandatory('business_service',true);
	}
   
}

Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy

it's still doesn't work. the asterisk disappears.

 

Hi @Snow Tomcal ,

Check if there are any onload client script or UI policy present for that field. That might be causing issue.


Please Mark My Response as Correct/Helpful based on Impact
Regards,
Gunjan Kiratkar
2X ServiceNow MVP
Community Rising Star 2022
Youtube : ServiceNow Guy

I didn't find one