Can We bypass the mandatory field in a form

sam352120
Kilo Guru

Hi ,

 

Can we submit a form by not filling the mandatory field .Is that possible through any script or any method.

Please share your ideas.

7 REPLIES 7

Brad Tilton
ServiceNow Employee
ServiceNow Employee

You would have to make the field not mandatory. You could just reverse what is currently making it mandatory or use g_form.setMandatory('fieldname', false); What the use case here?


User140988
Kilo Guru

You can use in a client script (onsubmit) or in a client side UI action.



g_form.checkMandatory = false;



this will bypass the mandatory check and the form will be submitted.


JonSNash
Tera Contributor

Be sure to investigate the UI policies and Access Controls for the field.   If it's a UI Policy making the field read only - it may be easier and more efficient to change the UI Policy conditions controlling when the field is read only than writing a new Client Script.


Jacob_Andersen
ServiceNow Employee
ServiceNow Employee

It really depends on what is making the field mandatory.   Is it a client script / ui policy?   Is it a data policy? Dictionary?   If set by the client, then a client script can undo the requirement.   Otherwise, you cannot bypass a mandatory field.