Buttons API reference
Section titled “Buttons API reference”This page is for integrators and developers who read, create or execute entity buttons through the API, or who need to know exactly what happens when a button is clicked. It documents the stored model, its numeric enums, validation, the endpoints and the execution flow.
How a button is stored
Section titled “How a button is stored”Internally a system button is not a bespoke collection: it is a regular DataEntry whose dataEntity is the built-in SYSTEM_BUTTON entity (StringConstants.SYSTEM_BUTTON_ENTITY_ID = 'SYSTEM_BUTTON', repository key SYSTEM_BUTTON_NAME = 'system_button'). This has two consequences:
- Create / update / delete go through the generic data-entry CRUD for the
system_buttonentity — not through theSystemButtonController. The dedicated controller only exposes read, status, options, and execute endpoints. - Buttons inherit
DataEntrymachinery:state,isInvalid,store, versioning, history, and space/store-based access scoping.
Source of truth: SystemButtonController (controllers/system-button.controller.ts), SystemButtonService (services/system-button.service.ts), and the models under models/system-buttons/.
Behaviour notes behind the designer options
Section titled “Behaviour notes behind the designer options”- Action types. The designer’s Action list groups the entity’s UI-level
custom actions under Custom Action (
RelevantActionTypeEnum.CustomEvent) and offers Navigation (Redirect) and Script under UI Action. OnlyCustomEventbuttons pass through the execute handler;RedirectandScriptbuttons are resolved in the client. Whether the bound reaction has a user interface is read from its custom action type being UISince 1.8, rather than from a separate flag on the reaction. For deeper external logic, the reaction a button fires can in turn invoke a function. - Scope.
actionTypesis aButtonActionTypeEnum[]:SingleEntry,MultipleEntriesandDataCollection. The designer offers Single Entry and Multiple Entries (multi-select);DataCollection(a list) is accepted by the API and the execute handler. - Custom-link tokens
Since 1.8. Token bindings for a Navigation button’s URL are stored asredirection.urlTokensMapand interpolated intoredirection.urlat read time when anentryIdis supplied. Each token’s value source is aTokenSourceType(Fixed,Field,Expression,Pointer). Token resolution is best-effort: a token that cannot be resolved (for example a field that no longer exists) is logged as a warning and the button falls back to the original, unresolved link text rather than blocking execution — no error reaches the end user. - Confirmation-dialog variables
Since 1.8are allowed only whenactionTypesis exactly[SingleEntry](enforced by validation). - Field-value mapping. Pre-fill values live in
relevantAction.fieldsMapping. The designer’s value types map toFieldValueTypeEnum: Field =Dynamic(a source path on the current entry), Manual, Not Set (null), Pointer (evaluates a context token such as @me and injects the resolved value with its display title) and Expression (stored JavaScript). The same mapping can also be turned into a filter: a multi-value context token such as My Groups builds an In condition, so a button can both pre-fill a form and scope which entries it targets. WhenrelevantAction.overrideFieldsMappingLockedFieldsis set, the mapped field names are treated as locked;getSystemButtonOverridableLockedFields(id)returns those names (else[]) so the override UI can lock them. - Availability filter. A button may carry a saved query (
query) and an inline filter (criteria); when both are present they are merged with AND. Saved queries are offered under the designer’s entries-source picker. Behaviour on non-matching entries isnonMatchEntriesMode:Disable(default) orHidden. The per-entry evaluation is described under Availability: status for entries. - Script buttons
Since 1.8store their body inrelevantAction.customScript. The client calls it with acontextargument exposingentity,view,entry,entriesandpopupManager; for a multi-entry buttoncontext.entriesholds every selected row.
Data model
Section titled “Data model”SystemButtonDataEntry
Section titled “SystemButtonDataEntry”Extends DataEntry; its constructor pins dataEntity = 'SYSTEM_BUTTON'. The button-specific payload lives entirely under value (SystemButtonDataEntryValue).
SystemButtonDataEntryValue
Section titled “SystemButtonDataEntryValue”| Field | Type | Required | Notes |
|---|---|---|---|
name | LocalizedValue | yes | Button label. Validated to be localized and unique per related entity. |
normalizedName | string | no | Auto-generated programmatic identifier derived from name, unique per related DataEntity. |
description | NullableLocalizedValue | no | Optional description. |
icon | Icon | yes | Button icon. |
relatedTo | DataEntityReferenceProperty | yes | The entity the button acts on. relatedTo.dataEntry is the entity id. |
relevantAction | SystemButtonRelevantAction | yes | What the button does (event / redirect / script). |
actionTypes | ButtonActionTypeEnum[] | yes | Which selection scopes the button supports (single / collection / multiple). |
isPublished | boolean | no (default false) | Only published buttons are returned by the “active” endpoints and are executable. |
query | ReferenceProperty | null | no | Reference to a stored data query whose criteria gate button availability. |
criteria | FilterExpression | no | Inline filter expression that gates button availability. Merged (AND) with query.criteria when both present. |
nonMatchEntriesMode | SystemButtonNonMatchEntriesMode | no | Behaviour when selected entries don’t match the criteria: disable vs. hide. |
confirmationDialog | SystemButtonConfirmationDialog | no | Optional confirmation dialog shown before execution. |
SystemButtonRelevantAction
Section titled “SystemButtonRelevantAction”| Field | Type | Notes |
|---|---|---|
type | RelevantActionTypeEnum | CustomEvent = 0, Redirect = 1, Script = 2. |
triggerId | string | For CustomEvent: the reaction/trigger id resolved against the reaction-service. |
redirection | SystemButtonRedirection | Primary redirection target. |
successRedirection | SystemButtonRedirection | Redirect on success. |
failureRedirection | SystemButtonRedirection | Redirect on failure. |
fieldsMapping | EntryActionOptionsValue[] | Field overrides passed to the action. |
overrideFieldsMappingLockedFields | boolean | When set, the mapped field names are treated as locked. |
customScript | string | Script body for Script-type buttons. Since 1.8 |
SystemButtonRedirection
Section titled “SystemButtonRedirection”| Field | Type | Notes |
|---|---|---|
type | ButtonRedirectionTypeEnum | RelatedEntries = 0, SameView = 1, Url = 2. |
relationId | string | Relation to navigate through (for relation-based redirects). |
relationRedirectionTarget | ButtonRelationRedirectionTargetEnum | EntriesList = 0, ShowEntryDetails = 1, CreateEntry = 2, UpdateEntry = 3. |
url | string | Target URL for Url redirects. |
urlTokensMap | { [key]: TokenSource } | Token bindings interpolated into url at read time when an entryId is supplied (keys use the str- prefix pattern). |
SystemButtonConfirmationDialog
Section titled “SystemButtonConfirmationDialog”Since 1.8
Shown before the button executes.
| Field | Type | Notes |
|---|---|---|
enabled | boolean (default false) | Master switch. |
title | NullableLocalizedValue | Dialog title (supports token placeholders). |
content | NullableLocalizedValue | Long-form body text (supports token placeholders). |
proceedButtonLabel | NullableLocalizedValue | Confirm-button label. |
cancelButtonLabel | NullableLocalizedValue | Cancel-button label. |
variables | SystemButtonDialogVariable[] | Token bindings used to interpolate title/content. Only allowed when actionTypes is exactly [SingleEntry]. |
SystemButtonDialogVariable: { name: string, valueType: TokenSourceType, value: any }. TokenSourceType is Fixed = 0, Field = 1, Expression = 2, Pointer = 3.
ButtonClickedHistory
Section titled “ButtonClickedHistory”Recorded per target entry after a CustomEvent button executes (via DataEntryHistoryService.createHistoryForButtonClicked, historyType = ButtonClickedHistory). Stores buttonId and the localized buttonName.
Enumerations
Section titled “Enumerations”RelevantActionTypeEnum CustomEvent = 0, Redirect = 1, Script = 2ButtonActionTypeEnum SingleEntry = 0, DataCollection = 1, MultipleEntries = 2SystemButtonNonMatchEntriesMode Disable = 0, Hidden = 1ButtonRedirectionTypeEnum RelatedEntries = 0, SameView = 1, Url = 2ButtonRelationRedirectionTargetEnum EntriesList = 0, ShowEntryDetails = 1, CreateEntry = 2, UpdateEntry = 3EventExecutorTypeEnum SYSTEM, MANAGER, EXECUTOR // EXECUTOR = the user who initiated the actionAskUserForEntityTypeEnum InlineEntity = 0, View = 1TokenSourceType Fixed = 0, Field = 1, Expression = 2, Pointer = 3Enum values are numeric (persisted as numbers) except EventExecutorTypeEnum, which is a string enum. Verified in packages/osos-shared/src/models/enums.ts.
Creating and updating a button (API)
Section titled “Creating and updating a button (API)”There is no POST /v1/system-buttons create endpoint. Buttons are managed through the generic data-entry CRUD, using the system_button entity:
| Operation | Route (from data-entries.controller.ts) |
|---|---|
| Create | POST /v1/entities/{entity}/entries |
| Update | PATCH /v1/entities/{entity}/entries/{id} (v1) / PATCH /v2/entities/{entity}/entries/{id} |
| Delete | DELETE /v1/entities/{entity}/entries/{id} |
Here {entity} resolves to the SYSTEM_BUTTON / system_button entity. The request body is a DataEntry whose value is a SystemButtonDataEntryValue as described above.
Validation
Section titled “Validation”SystemButtonValidator runs on the CREATE and UPDATE phases for the system_button entity. It enforces:
value.relatedTo.dataEntrymust be present, and the related entity must exist. If the related entity is implicit and notimplicitOptions.allowEdit, anImplicitEntityUpdateExceptionis thrown.- Confirmation-dialog variables are single-entry-only. If
confirmationDialog.variablesare present,actionTypesmust be exactly[SingleEntry]; otherwiseConfirmationDialogVariablesNotAllowedForMultiScopeException(SYSTEM_BUTTON_CONFIRMATION_DIALOG_VARIABLES_NOT_ALLOWED_FOR_MULTI_SCOPE). - For
CustomEventbuttons with atriggerId, the trigger is resolved against the reaction-service. A missing trigger throwsTriggerNotExistException; a trigger that is invalid (validations.isValid === false) ordisabledthrowsInvalidOrDisabledTriggerException. - Name uniqueness:
value.namemust be localized (LanguagesService.validateName) and unique per related entity — a match on any language value against another button of the samerelatedTo.dataEntrythrowsUniqueValueException.
Reading buttons (API)
Section titled “Reading buttons (API)”All SystemButtonController routes require Auth2 authentication and pass through the entity voter. Reads are scoped to the space’s readable stores (StoreService.getStoresForRead) and to state = Active, isInvalid = false.
| Method & Path | Purpose |
|---|---|
GET /v1/system-buttons | All active buttons in the space, enriched per button via the reaction-service (SystemButtonDataEntryDto[]). N+1 across a service boundary — slow for large spaces. |
GET /v1/system-buttons/raw | All active buttons as raw stored entries (SystemButtonDataEntry[]), no reaction enrichment; disabled-trigger buttons are not dropped. Intended for internal consumers (e.g. packaging import conflict detection). Since 1.8 |
GET /v1/system-buttons/count | Count of active buttons (Where filter supported). |
GET /v1/system-buttons/by-id/{id} | Single active, valid button by id (raw entry). 404 SystemButtonNotFound if not found. |
GET /v1/system-buttons/{relatedToId} | Buttons for a related entity (enriched DTOs). |
GET /v1/system-buttons/{relatedToId}/active?entryId= | Active (published) buttons a user can see for a related entity. Optional entryId resolves redirection-URL tokens and confirmation-dialog variables against that record. |
POST /v1/system-buttons/{relatedToId}/status/entries | Per-button enabled/hidden status across a set of entries (see Availability). |
GET /v1/system-buttons/{id}/options | Reaction actions for a CustomEvent button (DataReactionAction[]). |
GET /v2/system-buttons/{id}/options | v2 options: actions plus ask-user entity/view/dialog metadata (SystemButtonOptionsDto). |
POST /v1/system-buttons/{id} | Execute the button (see Execution). |
DTO enrichment
Section titled “DTO enrichment”getAllActiveSystemButtonsDto / getSystemButtonsByRelatedToDto fetch the bound reaction from the reaction-service and fold trigger metadata into relevantAction as a SystemButtonRelevantActionDto: triggerName, uiEvent, askUser, isTriggerDisabled, executionIndicator, messages, and executorType (defaulting to EventExecutorTypeEnum.EXECUTOR when the trigger has no explicit executor). In the “active” DTO listings, buttons whose bound trigger is disabled are skipped; the raw endpoint keeps them.
uiEvent is derived, not stored Since 1.8 — the DTO still tells the client whether the bound trigger has a user interface, but the trigger no longer carries a separate uiEvent flag. Both DTO builders now compute the field from the trigger’s custom action type: uiEvent is true exactly when the custom action type is UI. The wire shape is unchanged — still a plain boolean — so existing button consumers are unaffected; only the source of the value moved.
askUser is a second, independent flag Since 1.8. Because a button can now only ever be bound to a UI-level custom action (see System buttons can only fire UI-level actions below), uiEvent is true for every button — it can no longer tell a client whether clicking the button should open the “ask user” dialog first. SystemButtonRelevantActionDto therefore exposes a second boolean, askUser, computed as true exactly when the bound trigger’s eventConfig.askUser.enabled is set. Clients must gate the ask-user dialog on askUser, not uiEvent — a button bound to a UI action with no ask-user configuration now executes immediately, with no empty dialog popping up first.
When entryId is provided to getSystemButtonsByRelatedToDto, the service also:
- resolves
relevantAction.redirection.urlTokensMapagainst the record and interpolates them intoredirection.url, and - resolves
confirmationDialog.variablesinto token values and interpolates them into the dialogtitle/content(per language).
Both resolutions are best-effort: failures are logged as warnings and the button is still returned with unresolved text.
Ask-user options (GET /v2/system-buttons/{id}/options)
Section titled “Ask-user options (GET /v2/system-buttons/{id}/options)”For a CustomEvent button whose reaction has eventConfig.askUser.enabled, this returns the ask-user surface the UI must render:
mode = InlineEntity→ returns the reaction’s inlineentityasaskUserEntity.mode = View→ loads the configured entity + view and returns a projected entity viagetEntityBasedOnAskUserViewConfigurations, which keeps only the fields listed under the view’sAllowAskUserForsupported operation, renames the entity toaskUser, and re-ids it asTRASK_{entityId}_{triggerId}.
If the trigger is missing/invalid/disabled the same TriggerNotExistException / InvalidOrDisabledTriggerException errors apply.
Fields inside a shared block are kept Since 1.8 — the view’s AllowAskUserFor allow-list holds fullNormalizedNames such as cc.email or attachment. A top-level field is kept when its normalizedName matches an allowed entry; a sub-field of an internal entity (a block) is kept when any of its block-qualified names is allowed. That “any” rule is what makes shared blocks work: when one block definition backs several top-level block fields — To / CC / BCC recipient blocks, say — the projected entity emits that block’s sub-fields once per prefix (to.email, cc.email, bcc.email, …), all carrying the same sub-field id. A view that exposes only cc.* and bcc.* still keeps those shared sub-fields, because the match is tested against every block-qualified occurrence of the id rather than only the first one encountered. So you can now ask the user for a sub-field that lives inside a shared block.
Availability: status for entries
Section titled “Availability: status for entries”POST /v1/system-buttons/{relatedToId}/status/entries answers “for these selected records, is each button enabled or hidden?”.
Request body (GetSystemButtonsStatusForEntriesRequestDtoModel):
{ "dataEntriesIds": ["<entryId>", "..."], "selectAll": { "enabled": true, "...": "SelectAllDto criteria" }}You must supply either dataEntriesIds or selectAll.enabled = true; otherwise GetSystemButtonsStatusForEntriesMustProvideIdsOrSelectAllException (GET_SYSTEM_BUTTONS_STATUS_FOR_ENTRIES_MUST_PROVIDE_IDS_OR_SELECT_ALL). With selectAll, the entry ids are resolved from the query engine (getEntriesIdsBySelectAllDto).
Response is SystemButtonStatusForEntriesResponseDtoModel[]: { systemButtonId, isDisabled, isHidden }.
Logic (getSystemButtonsStatusForEntries + generateGetButtonsStatusForEntriesAggregationStages):
- Buttons with no
queryand nocriteriaare alwaysisDisabled: false. - For buttons with a filter, a MongoDB aggregation runs a
$facet— one branch per button — that counts how many of the selected entries match the button’s criteria (query.criteriamerged with inlinecriteriaviaAND). A button is enabled only if every selected entry matches (matchingEntriesCount === dataEntriesIds.length); otherwise it is disabled. - When no selected entry matches at all, the non-match behaviour depends on
nonMatchEntriesMode: default (Disable) →{ isDisabled: true, isHidden: false };Hidden→{ isDisabled: true, isHidden: true }. - System fields such as
@current_user/@myGroupsin the criteria are resolved viagetSystemFieldsStagesbefore the facet.
Executing a button
Section titled “Executing a button”POST /v1/system-buttons/{id} with an ExecuteSystemButtonDto body:
| Field | Type | Notes |
|---|---|---|
mode | ButtonActionTypeEnum | Selection scope of this execution. |
source | string | string[] | Single entry id, data-collection id, or an array of entry ids — depending on mode. |
askUserValue | IEntryValue | The ask-user payload collected from the dialog, forwarded to the reaction. |
selectAll | SelectAllDto | For MultipleEntries with select-all: resolves the full id set server-side. |
Execution flow (only meaningful for RelevantActionTypeEnum.CustomEvent; Redirect/Script buttons are resolved client-side and do not go through this handler):
- View guard — if the request is scoped to a
DataViews, the button must be listed inview.systemButtons, elseSystemButtonNotFound. - Load button — must be
state = Active,isInvalid = false, andvalue.isPublished = true, elseSystemButtonNotFound. - Resolve target entries from
mode+source:SingleEntry→ oneReferencePropertyforsource.DataCollection→ the collection’sitems(the collection must belong to the button’s related entity, elseDataCollectionNotFoundException).MultipleEntries→ the id array; ifselectAll.enabled, ids are expanded viagetEntriesIdsBySelectAllDto.- Missing
source→MissingPropertyException.
- Re-check availability for the resolved entries; if the button is disabled for that set,
SystemButtonIsDisabled(SYSTEM_BUTTON_IS_DISABLED, 403). UI-level guardSince 1.8— ifrelevantAction.triggerIdis set, the bound trigger’s custom action type is checked; aLocalorExternalbinding is rejected withSystemButtonNotUiCustomAction(403). See System buttons can only fire UI-level actions below.- Emit feedback + publish event — a
JobScheduledMessageis emitted over the socket immediately for UI feedback, then aCustomEventTriggeredEvent(entity id, target entries, user id,triggerId, timestamp,askUserValue) is published on the service bus, carryingmessageId,instanceId,correlationId(trace id) and sticky attributes (userId,delegateeId,delegationId,spaceId). The reaction-service handler picks this up. - History —
createHistoryForButtonClickedrecords aButtonClickedHistoryentry per target.
The endpoint returns the generated messageId (a UUID) so the client can correlate the async execution result.
System buttons can only fire UI-level actions Since 1.8
Section titled “System buttons can only fire UI-level actions Since 1.8”A button’s relevantAction.triggerId can, structurally, point at any CustomEvent reaction — nothing stops it from naming a Local- or External-level custom action, which are meant to be invoked only by another reaction’s Execute Custom Action action, not by a button click. Step 5 of the execution flow above closes that gap: it loads the bound trigger’s custom action type before publishing the execution event, and rejects the click with SystemButtonNotUiCustomAction (403, “this button is bound to a custom action that is not a UI action”) when it is Local or External.
This is a backstop, not the primary defence — the button editor lists only UI-level custom actions in its Action picker, so a non-UI trigger cannot be chosen there. The runtime check exists for buttons saved before that editor restriction shipped, and for direct API writes that bypass the editor. A button whose trigger can’t be loaded at all (a transient lookup failure, or no triggerId set) is not rejected by this check — it only blocks an explicitly non-UI level, not “anything uncertain.”
The reverse direction — an Execute Custom Action action can never target a UI-level custom action — is enforced when the reaction is saved; see Execute Custom Action.
Execute example
Section titled “Execute example”POST /v1/system-buttons/{buttonId}Content-Type: application/json
{ "mode": 0, "source": "8f3c...entryId"}For a multi-entry execution with select-all:
{ "mode": 2, "selectAll": { "enabled": true }}Preview mode
Section titled “Preview mode”GET /v1/system-buttons/{relatedToId}/active in preview mode returns the entity’s real buttons (real name/icon/config) but with fake ids (FakeEntryGeneratorService.withFakeIds) so none can be executed against a fake entry; entryId is intentionally not forwarded to the real query in preview mode. If the current view has an empty systemButtons list, the endpoint returns [].
Implementation notes
Section titled “Implementation notes”- Store/space scoping is applied in
buildActiveSystemButtonsWhereand ingetSystemButtonsByRelatedToDto: buttons are filtered bystore.dataEntry ∈ readableStores,state = Active,isInvalid = false, and (for active listings)value.isPublished = true. - N+1 caution: the enriched DTO listings call the reaction-service once per button.
getAllActiveSystemButtonsRaw/GET /v1/system-buttons/rawexists specifically to avoid this for consumers that only need stored data. getSystemButtonOverridableLockedFields(id)returns the mapped field names whenrelevantAction.overrideFieldsMappingLockedFieldsis set (else[]) — used to lock the mapped fields in the override UI.- The
ExecuteSystemActionOverrideValuesDto({ actionId, options }) and the commented-outgetTriggerToExecuteForSystemButton/validateSystemButtonTriggerin the service indicate an older action-override path that is currently inactive; override handling now lives in the reaction-service. Do not rely on those commented blocks.
Version notes
Section titled “Version notes”| Feature | Milestone |
|---|---|
Custom script action (relevantAction.customScript) | Since 1.8 |
Confirmation dialog (confirmationDialog, dialog variables) | Since 1.8 |
| Custom-link / confirmation-dialog tokens | Since 1.8 |
Raw listing endpoint (GET /v1/system-buttons/raw) | Since 1.8 |
uiEvent derived from the trigger’s custom action type (replaces the stored flag) | Since 1.8 |
askUser on the button’s relevant-action DTO (the ask-user dialog gate, independent of uiEvent) | Since 1.8 |
System buttons rejected at execution when bound to a Local/External custom action (SystemButtonNotUiCustomAction, 403) | Since 1.8 |
normalizedName on buttons | Since 1.6 |
Non-match-entries mode (nonMatchEntriesMode) and the v2 options endpoint predate the 1.2 milestone, so they carry no availability badge (treat as Long-standing).
Platform 1.10.0 · Backend 1.11.0-alpha.11 · Frontend 1.11.0-alpha.6 · Mobile 1.10.2 · Chart 1.11.8 · Gateway 2.6.11 · MCP 0.2.0 · Grafana DS 1.2.0Docs build 2026-11-27