What This Table Is
The sys_ui_policy table stores UI Policy definitions that control form field behavior at runtime. Each record defines conditions and actions that make fields visible/hidden, mandatory/optional, or read-only/writable based on field values and user context.
This table belongs to the Development module and supports ServiceNow's declarative form customization framework. UI Policies execute client-side in the browser, providing immediate field state changes without server round-trips. They're processed in order by the order field value, with lower numbers executing first.
UI Policies don't extend other tables and aren't extended by child tables. They work alongside sys_ui_policy_action records that define the specific field actions to execute when conditions are met. The relationship is one-to-many: one policy can have multiple actions affecting different fields.
Large enterprises typically have 200-500 UI Policy records per major application, with incident and change management forms having the most policies. Performance degrades when more than 20-30 policies apply to a single form, as each policy evaluation adds client-side processing overhead.
When You'll Script Against This Table
Most developers query sys_ui_policy from Script Includes when building form customization tools, or from Background Scripts when auditing form configurations. Business Rules rarely need to touch this table directly since UI Policies handle client-side logic while Business Rules handle server-side logic.
The ui_policy_admin role controls create/update/delete access. Developers with admin can read all policies but need the specific role to modify them. Application-scoped policies respect scope boundaries for cross-scope access.
Common scripting patterns:
- Bulk disable policies during data imports to improve performance
- Clone policies across similar tables (incident to problem, etc.)
- Audit which policies affect specific fields for debugging
- Generate documentation of form behavior by table
- Reorder policy execution by updating order values
- Export/import policy configurations between instances
Table Gotchas
UI Policies with no conditions (empty condition field) always evaluate to true and execute every time the form loads or field values change.
The order field doesn't automatically renumber when you insert policies between existing ones. You must manually manage order values to control execution sequence.
- The
tablefield stores the exact table name, not the label. Extended tables inherit policies from parent tables unless overridden. - Policies execute on list views when
applies_toincludes 'list', but only affect inline editing scenarios.
Policies can conflict with each other. If two policies affect the same field with opposite actions (one sets mandatory, another sets optional), the last one to execute wins.
- Performance suffers when policies have complex conditions with OR operators or multiple field references. Keep conditions simple.
- The
activefield only controls whether the policy loads on forms. Inactive policies still appear in Studio and can confuse developers.
Enjoying this? Get one deep-dive per week.
Join 1,000+ ServiceNow pros — scripts, GlideRecord patterns, Flow Designer techniques, and career moves. Free.
Related Tables
UI Policies work hand-in-hand with sys_ui_policy_action records that define the actual field modifications. Every policy typically has 1-10 associated actions. You'll also frequently query sys_dictionary to understand field types when building policy conditions, and sys_db_object to validate table names in the table field.
When building comprehensive form automation, developers often combine UI Policies with sys_ui_script for client scripts and sys_script for business rules. The sys_ui_section table becomes relevant when policies need to show/hide entire form sections rather than individual fields.
For auditing and compliance reporting, you'll cross-reference sys_update_xml to track policy changes over time, and sys_scope to understand which application owns specific policies in scoped environments.