Client Scripts vs. UI Policies
Client Scripts and UI Policies both execute
client-side logic and use the same API. Both are used to manage forms
and their fields. When developing an application, how can you decide
which client-side script type to use? Use this table to determine which
type is best suited to your application’s needs:
Criteria | Client Script | UI Policy |
---|---|---|
Execute on form load | Yes | Yes |
Execute on form save/submit/update | Yes | No |
Execute on form field value change | Yes | Yes |
Have access to field’s old value | Yes | No |
Execute after Client Scripts | No | Yes |
Set field attributes with no scripting | No | Yes |
Require control over order of execution | *Yes | Yes |
*Although the Order field is not on the Client Script form baseline you can customize the form to add it.
UI Policies execute after Client Scripts. If there
is conflicting logic between a Client Script and a UI Policy, the UI
Policy logic applies.