# Instructions for Fluent UiPolicy API
Always reference the UiPolicy API specifications for more details.
1. Import `UiPolicy` from `@servicenow/sdk/core`. The `$id` field is mandatory and must be unique, typically using `Now.ID['value']`. The `shortDescription` field is mandatory and must be a non-empty string.
2. The `actions` array controls field visibility, mandatory, and read-only states. Use `'ignore'` for `visible`, `readOnly`, and `mandatory` to leave the current state unchanged. Use boolean `true`/`false` to explicitly set the state.
3. Set `reverseIfFalse: true` to automatically reverse all actions when the condition becomes false. This is the most common pattern for dynamic form behavior, avoiding the need for separate `scriptFalse` logic.
4. The `runScripts` property must be set to `true` for `scriptTrue` and `scriptFalse` to execute. Without `runScripts: true`, the scripts are ignored even if provided.
5. The `relatedListActions` array controls visibility of related lists on the form. The `list` property takes a `child_table.reference_field` identifier for a reference-based related list (e.g. `'incident_task.incident'`: exactly two non-empty parts), or the sys_id of a `sys_relationship` record (a `Record<'sys_relationship'>` is also accepted). Do not include the `REL:` prefix; the plugin adds it, and building it with `'REL:' + ...` fails (TS303).
6. Set `onLoad: true` to execute the UI Policy when the form first loads. When `false`, the policy only runs when field values change. Use `onLoad: true` for policies that need to set initial field states.
7. The `uiType` property controls which user interface the policy targets: `'desktop'` for standard UI, `'mobile-or-service-portal'` for mobile and portal, or `'all'` for both.
8. Use `fieldMessage` and `fieldMessageType` in actions to display inline messages on fields. Valid message types are `'error'`, `'info'`, `'warning'`, and `'none'` (to clear a message).
9. **SDK v4.13.0** — `UiPolicy` accepts `$meta` with `installMethod` (`'demo'`, `'once'` or 'first install') to control when the policy record loads. Omit it for a policy that should always install. Do not use `'demo'` on it: demo data is only for rows of tables that do not extend `sys_metadata` (demo-data-guide, SDK v4.14.2).
