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 Mandatory field optional in a form

leoarockiasamy
Kilo Contributor

I am new to ServiceNow development and this is my first post.

I am trying to use a custom field as optional in a form, but the field is marked as Mandatory in Dictionary.

Can someone help me with a way to do that?

Also, what is the best practice?

1 ACCEPTED SOLUTION

Chuck Tomasi
Tera Patron

If it is mandatory in the dictionary, there's no overriding it from a client script or UI policy. You'll need to uncheck mandatory in the dictionary (or a dictionary override if the field is on a base table like task) and then use a UI policy to make it mandatory when you need, and not when not.



Dictionary overrides


UI policies


View solution in original post

3 REPLIES 3

kristenankeny
Tera Guru

You need to update the dictionary to make it not mandatory. Then you will need to update any page that displays the field to run a ui policy or client script to make the field mandatory in the appropriate situations.


Chuck Tomasi
Tera Patron

If it is mandatory in the dictionary, there's no overriding it from a client script or UI policy. You'll need to uncheck mandatory in the dictionary (or a dictionary override if the field is on a base table like task) and then use a UI policy to make it mandatory when you need, and not when not.



Dictionary overrides


UI policies


Pradeep Sharma
ServiceNow Employee
ServiceNow Employee

Hello Leo,



Even if the field is set to mandatory via a dictionary, we can override the mandatory values via client script or UI policies i.e create a UI policy and set the mandatory field to false per condition filter on your table.



Please let me know if you have any questions.