
UI Policies
UI Policies are a user-friendly way to control whether fields on a form are mandatory, read-only, or even whether they're visible. The UI Policy record itself, which resides in the UI Policy [sys_ui_policy] table, consists of a set of conditions, a short description, a relationship to another record or set of records, and a few other odds and ends. It does not however, contain information on the action to be performed:

UI Policy Actions are stored separately, in the UI Policy Action [sys_ui_policy_action] table. They are related to the UI Policy via a reference field, which - as we discussed in a previous chapter - means that they can (and by default, do) show up in a related list at the bottom of the UI Policy form:

These UI Policy Actions consist of a reference to the field to which the action applies, and drop-downs indicating whether the field should be Visible, Mandatory, or Read-Only. Each field has three options: True, False, and Leave Alone. As you might imagine, creating a UI Policy Action where the Read-Only drop-down is set to True, will make the field to which it applies, true. This will only apply on the table to which the parent UI Policy applies. Further, unless the Global tick-box is checked on the parent UI Policy (which it is, by default), it will only apply to the view specified on the parent UI Policy:

In order for a UI Policy Action to apply to a given field (or in the case of catalog UI Policy Actions, a given variable), it must appear on the form in question. The same is true if the field is used as part of a Condition. Even if the field is not visible, it must be included on the form in order to be evaluated as part of a policy condition, or set as part of a policy action.