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.

Make field mandatory on submit (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 🙂

1 ACCEPTED SOLUTION

RaghavSh
Mega Patron

Try below:

 

function onSubmit(){

g_form.setMandatory('field_name', true);

return false;

}


Raghav
MVP 2023
LinkedIn

View solution in original post

2 REPLIES 2

RaghavSh
Mega Patron

Try below:

 

function onSubmit(){

g_form.setMandatory('field_name', true);

return false;

}


Raghav
MVP 2023
LinkedIn

It works, Thanks!