UI Policies

TODO:FIXME

Jace Benson

Table of content
  1. How They Work
  2. UI Policies vs. Client Scripts
  3. Data Policies (Server Side)
  4. Further Reading

Docs

UI Policies let you control form fields — make them mandatory, read-only, visible, or hidden — based on conditions evaluated on the client side. They run in the browser, not on the server, which means they can respond instantly when a user changes a field value.

Unlike client scripts, UI Policies don't require JavaScript to set field states. You configure them declaratively: "When field X equals Y, make field Z mandatory and read-only." The platform handles the rest.

How They Work

A UI Policy record has:

You can also write a UI Policy Script for complex conditions that the condition builder can't express.

UI Policies vs. Client Scripts

Aspect UI Policy Client Script
What it does Set field states Run arbitrary JavaScript
Complexity Declarative — no code needed Full scripting
Performance Lighter — built-in form behavior Heavier — runs custom code
Best for Show/hide, mandatory, read-only Calculations, Ajax calls, complex validation

In general: if you can do it with a UI Policy, do it with a UI Policy. Client scripts are for when UI Policies won't cut it.

Data Policies (Server Side)

Don't confuse UI Policies with Data Policies. UI Policies are client-side — they only affect the browser. Data Policies are server-side — they enforce mandatory/read-only on the server, which means they apply even when data comes through web services or import sets.

If you need a field to be mandatory regardless of how data enters the system, use a Data Policy. If you only need it on the form, use a UI Policy.

Further Reading