logo

NJP

Why Your “Mandatory” Fields Aren’t Really Mandatory (And How to Fix It)

New article articles in ServiceNow Community · Feb 18, 2026 · article

Hello Community,

 

We’ve all been there: you make a field mandatory on a form using UI Policy, only to find a week later that someone bypassed it via a List Edit , an Excel Import , or an API integration.

 

In ServiceNow, "Mandatory" doesn't always mean "Mandatory everywhere." To keep your data clean, you need to pick the right tool for the job. Here is a simplified guide to the 5 ways to enforce fields without annoying your users.


1. The "Everywhere" Rule: Dictionary Entry

What it is: A checkbox on the field’s database definition i.e. Dictionary entry.

  • Best for: Fields that must exist for the record to make sense (e.g., "Short Description" on a Task).

  • The Vibe: Permanent and non-negotiable.

  • Watch out: It’s "all or nothing." You can’t make it mandatory only for "In Progress" tickets.

  • Navigate : All > System Definition > Dictionary

 

2. The "Smart Form" Rule: UI Policies

What it is: A no-code way to make fields mandatory based on conditions (e.g., "If State is Closed, Resolution Code is mandatory").

  • Best for: Guiding users through a form. It shows that helpful red asterisk instantly.

  • The Vibe: User-friendly and visual.

  • Watch out: It only works in the browser. It won't stop a bulk import or a background script.

  • Navigate : All > System UI > UI Policies

    PrasadShelar_2-1771438496115.png

3. The "Power User" Rule: Data Policies

What it is: The "Big Brother" of UI Policies. It enforces rules at the server level.

  • Best for: Blocking bad data from Imports, Web Services, and List Edits.

  • The Vibe: Robust and secure.

  • Pro Tip: Check the "Use as UI Policy" box so it also acts like a UI Policy on your forms. It's the best of both worlds!

  • Navigate : All > System Policy > Rules > Data Policies

    PrasadShelar_4-1771438657045.png

 

4. The "Complex Logic" Rule: Client Scripts

What it is: Custom JavaScript (browser-side) for when the Condition Builder isn't enough.

  • Best for: Validating specific patterns, like ensuring a "Serial Number" starts with "SN-" and has 8 digits.

  • The Vibe: Highly customizable but requires coding.

  • Watch out: Too many scripts can slow down your form load times.

  • Navigate : System Definition > Client Scripts

    PrasadShelar_5-1771438758286.png

 

5. The "Last Line of Defense": Business Rules

What it is: Server-side scripts that run right before a record hits the database.

  • Best for: Cross-table validation (e.g., "Don't allow closing this Change if the linked CI is currently 'Down'").

  • The Vibe: The ultimate gatekeeper.

  • Watch out: Users don't see the error until after they hit Save, which can be frustrating.

  • Navigate : System Definition > Business Rules

    PrasadShelar_7-1771438869116.png

 


💡Quick Cheat Sheet: Which one do I choose?

| If you want to... | Use this... |
| Always require a value | Dictionary |
| Require it conditionally on a form                              .  | UI Policy |
| Block bad imports/API calls | Data Policy |
| Validate a Regex pattern | Client Script |
| Check other tables before saving | Business Rule |


Summary

Don't rely on just one method. For critical data, use Defense in Depth :

  1. Use a UI Policy so the user knows what to do.

  2. Use a Data Policy to catch the people trying to sneak around the UI!


What’s your favorite "Gotcha" when it comes to mandatory fields? Let’s discuss in the comments! 👇

 

If this helped you in any way, don't forget to hit the like button! 👍

View original source

https://www.servicenow.com/community/developer-articles/why-your-mandatory-fields-aren-t-really-mandatory-and-how-to-fix/ta-p/3492162