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.

Client script to make mandatory fields not mandatory on submit.

eliana_wise
Tera Contributor

Hi,

I need help with the client script that make the mandatory field not mandatory when I click cancel change. Please advice.

Thanks

1 ACCEPTED SOLUTION

Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Eliana,



Try with g_form.checkMandatory = false; to ignore all mandatory fields on the form


View solution in original post

2 REPLIES 2

Jaspal Singh
Mega Patron
Mega Patron

Hi Eliana,



You can use something as below



function onSubmit() {


    //Type appropriate comment here, and begin script below


    g_form.setMandatory('field_name',false);


}


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Eliana,



Try with g_form.checkMandatory = false; to ignore all mandatory fields on the form