# System events

<a id="database.osevents"></a>

## osevents

> **Warning:** The column list comes from the schema dump; the column meanings have been derived
from the JSON returned by [dms.GetOsEvents](../dms.md#dms.GetOsEvents) and the input
parameters of [dms.CreateOsEvent](../dms.md#dms.CreateOsEvent) /
[dms.UpdateOsEvent](../dms.md#dms.UpdateOsEvent). A few columns remain marked as uncertain.

Holds the OS events defined in the enaio® application. One entry per event with the event
type (`eventcode`), the target object type (`osclassname`), the script code (`vbcode`) and
an optional context parameter (`oseventparams`). Meaning of the individual values, lifecycle
and the full format of the JSON representation: see
OS events in the DMS reference.

DMS API read path: [dms.GetOsEvents](../dms.md#dms.GetOsEvents); write paths:
[dms.CreateOsEvent](../dms.md#dms.CreateOsEvent) /
[dms.UpdateOsEvent](../dms.md#dms.UpdateOsEvent) /
[dms.DeleteOsEvent](../dms.md#dms.DeleteOsEvent).

### Columns

| Name | Type | Length | Description |
|---|---|---|---|
| `id` | `int` | — | Primary key — corresponds to the field<br>`id` in the JSON returned by<br>[dms.GetOsEvents](../dms.md#dms.GetOsEvents). Used by<br>[dms.UpdateOsEvent](../dms.md#dms.UpdateOsEvent) and<br>[dms.DeleteOsEvent](../dms.md#dms.DeleteOsEvent) as `OsEventId`. |
| `eventcode` | `int` | — | Event type — determines **when** the script is executed. Corresponds to the JSON field<br>`event_code`. Can be resolved against<br>[`oseventcodes.eventcode`](system_events.md#database.oseventcodes). Full value list:<br>event code list. |
| `osclassname` | `nvarchar` | 100 | Target object type — `"Application"` for server- or application-wide events, otherwise<br>the `type_id` of the object type as a string. Corresponds to the JSON field<br>`os_class_name`. |
| `oseventpos` | `int` | — | UI context as a numeric representation (`1` = query, `2` = application, `3` = data sheet,<br>`5` = object type, `6` = bulk change, `7` = cabinet, `8` = server events, `9` = result<br>list). Redundant with `eventcode`. Corresponds to the JSON field<br>`object_class`. |
| `osuserid` | `int` | — | Numeric user ID — presumably the user who last edited the event (internal ID matching<br>the login name in `modifyuser`). Exact semantics not fully confirmed. |
| `oseventtype` | `int` | — | Target platform as a numeric representation (`1` = client, `2` = server, `3` = WebClient).<br>Corresponds to the JSON field `app_class`. |
| `vbcode` | `image` | max | Executable script code of the event. Despite the column name, the content can be either<br>VBScript or JavaScript — see field `vb_code` and<br>field `is_js`. Whether and where `is_js` is stored<br>separately in `osevents` is not unambiguously identified — for JavaScript libraries<br>(`eventcode` 10005/10006) and WebClient events (`eventcode` 11000–11024) the script<br>language is implicitly JS. |
| `oseventparams` | `nvarchar` | 100 | Context parameter — content depends on the `eventcode`: field GUID, job name or library<br>name. Corresponds to the JSON field<br>`os_event_params`. Full mapping:<br>`os_event_params` — mapping. |
| `lastmodified` | `int` | — | Unix timestamp (seconds since `1970-01-01 UTC`) of the last modification.<br>Corresponds to the JSON field `last_modified`. |
| `modifyuser` | `nvarchar` | 255 | Login name of the user who last edited (created or modified) the event. Corresponds to<br>the JSON field `modify_user`. |

### Related Tables

* [oseventcodes](system_events.md#database.oseventcodes) — lookup table of all known event codes
with name, `objectclass` (as text) and `appclass` (as text).
* [oseventaccess](system_events.md#database.oseventaccess) — access permissions on events per
user/group (`eventid` → `osevents.id`).

### Usage by Server API jobs

* [dms.GetOsEvents](../dms.md#dms.GetOsEvents) — reads events as JSON.
* [dms.CreateOsEvent](../dms.md#dms.CreateOsEvent) — creates a new event.
* [dms.UpdateOsEvent](../dms.md#dms.UpdateOsEvent) — updates the script code of an event.
* [dms.DeleteOsEvent](../dms.md#dms.DeleteOsEvent) — deletes an event.

<a id="database.oseventcodes"></a>

## oseventcodes

> **Warning:** This page was automatically generated from the database schema dump and may be incomplete or incorrect.

Known event codes.

### Columns

| Name | Type | Length | Description |
|---|---|---|---|
| `eventcode` | `int` | — |  |
| `eventname` | `nvarchar` | 100 |  |
| `objectclass` | `nvarchar` | 100 |  |
| `appclass` | `nvarchar` | 100 |  |
| `descrshort` | `nvarchar` | 248 |  |
| `osdescription` | `image` | 2147483647 |  |

<a id="database.oseventaccess"></a>

## oseventaccess

> **Warning:** This page was automatically generated from the database schema dump and may be incomplete or incorrect.

Access permissions for events.

### Columns

| Name | Type | Length | Description |
|---|---|---|---|
| `eventid` | `int` | — |  |
| `osuserid` | `int` | — |  |
| `osgroupid` | `int` | — |  |
