# Client-side API

The `ComindView` global is the main entry point for client-side logic. It is available inside `views/logic/index.ts` and is typed in `api/typings/cmw-client.ts`. For usage patterns and examples, see [View logic](/developer-guide/building-blocks/view-logic.md). For server-side equivalents, see [Server-side API](/developer-guide/reference/server-side-globals.md).

## Properties[​](#properties "Direct link to Properties")

| Property                 | Type     | Purpose                                                                                                |
| ------------------------ | -------- | ------------------------------------------------------------------------------------------------------ |
| `ComindView.action`      | `string` | Current action name (e.g. `'add'`, `'edit'`)                                                           |
| `ComindView.actionMode`  | `string` | Form mode - `'mass-edit'`, `'editable'`, `'editing'`, `'full-form'`, `'plain-with-comment'`, `'plain'` |
| `ComindView.workspace`   | `object` | Current workspace context with `.alias`, `.current_user_id`, `.group_participants`, `.tabs`            |
| `ComindView.schema`      | `object` | Loaded app schema - fields, actions, lookups, `publishing_alias`                                       |
| `ComindView.currentUser` | `object` | User info - `.id`, `.email`, `.isWorkspaceAdmin`, `.isGlobalAdmin`, `.isInGroup(name)`                 |

## ViewLogic methods[​](#viewlogic-methods "Direct link to ViewLogic methods")

These methods are defined in your `views/logic/index.ts` export. See [View logic](/developer-guide/building-blocks/view-logic.md) for the export pattern and detailed examples.

**Lifecycle hooks:**

| Method            | Purpose                                                               |
| ----------------- | --------------------------------------------------------------------- |
| `onReady()`       | Form loaded and ready                                                 |
| `onRefresh()`     | Form data refreshed                                                   |
| `onDestroy()`     | Form being destroyed                                                  |
| `onReset()`       | Form reset                                                            |
| `onBeforeSave()`  | Pre-save validation - return `false` or an error string to block save |
| `onGridLoaded()`  | Embedded grid finished loading                                        |
| `onInputChange()` | Field value changed                                                   |

**Dynamic field control:**

| Method                 | Purpose                                      |
| ---------------------- | -------------------------------------------- |
| `getInvisibleFields()` | Return field names to hide                   |
| `getRequiredFields()`  | Return field names to make required          |
| `getReadonlyFields()`  | Return field names to make read-only         |
| `getFilterKeys()`      | Filter keys for lookups                      |
| `getFieldOverrides()`  | Override field schema properties dynamically |
| `helperFunction()`     | Register helper functions                    |

## Record navigation[​](#record-navigation "Direct link to Record navigation")

Methods for traversing the record hierarchy. Parent, child, and sibling accessors return data synchronously from the already-loaded context. The async methods fetch records on demand.

| Method                                           | Purpose                        |
| ------------------------------------------------ | ------------------------------ |
| `ComindView.parentRecord(fieldName?)`            | Access parent record data      |
| `ComindView.childRecords(appAlias?, fieldName?)` | Access child records           |
| `ComindView.siblingRecords()`                    | Access sibling records         |
| `ComindView.getLinkedRecordAsync(fieldName)`     | Async fetch of a linked record |
| `ComindView.getRecordById(id)`                   | Async fetch any record by ID   |

## Settings and variables[​](#settings-and-variables "Direct link to Settings and variables")

| Method                        | Purpose                                           |
| ----------------------------- | ------------------------------------------------- |
| `ComindView.getVars()`        | Get app variables (workspace-level, set by admin) |
| `ComindView.getSetting(name)` | Get an app setting value                          |

## Grid methods[​](#grid-methods "Direct link to Grid methods")

Methods for working with embedded child grids.

| Method                                                 | Purpose                                        |
| ------------------------------------------------------ | ---------------------------------------------- |
| `ComindView.addGridRow(values, appAlias?, fieldName?)` | Programmatically add a row to an embedded grid |

## Requests[​](#requests "Direct link to Requests")

| Method                             | Purpose                       |
| ---------------------------------- | ----------------------------- |
| `ComindView.request(url, config?)` | HTTP request from the browser |

## UI utilities[​](#ui-utilities "Direct link to UI utilities")

| Method                                   | Purpose                                     |
| ---------------------------------------- | ------------------------------------------- |
| `ComindView.uiUtils.getFgHexColorByBg()` | Get foreground color for a given background |
| `ComindView.uiUtils.safeDigest()`        | Safely trigger Angular digest cycle         |
| `ComindView.uiUtils.setTabCounter()`     | Set a counter badge on a tab                |

## Related pages[​](#related-pages "Direct link to Related pages")

* [View logic](/developer-guide/building-blocks/view-logic.md) - developer patterns for using these methods in `views/logic/index.ts`
* [Actions](/developer-guide/building-blocks/actions.md) - server-side action definitions that complement client-side hooks
* [Fields](/developer-guide/building-blocks/fields-and-field-options.md) - field db names, types, and the options catalog
* [Server-side API](/developer-guide/reference/server-side-globals.md) - global variables and functions available in server-side logic
