Skip to content

Action Hooks

Menu: Settings -> Action Hooks (advanced menu) List: /_Admin/system/backend-events?SiteId={siteGuid} Edit: /_Admin/system/backend-events/edit?SiteId={siteGuid}&name={eventName}&display={displayName}

Action Hooks fire rules before and after backend resource operations such as create, update, and delete, for auditing, synchronization, notifications, or business validation before a resource is saved. They map to server-side BackendRule + BackendEvent. Rules run only when the site-level enableBackendEvents switch is on.

Permissions

ActionPermission
View the hook list and edit pagebackendEvents
Toggle Hook On / Off in the top-rightsite·edit (saves site field enableBackendEvents)
New Hook, edit rules, and SavebackendEvents·edit
Multi-select Delete all rules under an eventbackendEvents·edit

In the current UI, New Hook and Save on the edit page still check frontEvents·edit; verify that permission when assigning roles.

Master switch

Besides Hook On on this page, Action Hooks (enableBackendEvents) in Basic Settings · Advanced must be on. Both controls edit the same site field; if either is off, no action hooks run.

Distinction from Request Hooks

Request HooksAction Hooks (this page)
When they runFront-end HTTP requests (Route / Page / View)Backend resource operations (create / update / delete, etc.)
Path/system/front-events/system/backend-events
Rule resourceBusinessRuleBackendRule
Master switchenableFrontEventsenableBackendEvents

How to Open

  1. In Edit Menu, enable Settings -> Action Hooks.
  2. Open Settings -> Action Hooks in the left sidebar.
Action hooks list

Toolbar

ControlDescription
New HookOpens hook type picker (event types already configured are hidden)
Hook On / OffenableBackendEvents; toggling saves the site immediately (saveSite)
Status textWhen on, shows “Hook On” (blue); when off, gray “Hook Off”
Action hooks toolbar

Hook List

ColumnDescription
TypeLocalized display of event name (e.g. PageCreated → “Page created”; wording follows login language)
Rule countNumber of saved rules for that event
EditOpens rule edit page

Multi-select Delete removes all rules for the selected event types (BackendRule/DeleteEvents), not individual rules.

Action hooks list

New Hook

Click New Hook to open the Hook list, grouped by resource category. Click a type to open the edit page (the row may not appear until rules are saved).

Hook type picker

Available Event Types

The hook list is grouped by resource. Display names are localized via server Hardcoded; use BackendRule/EventList as the source of truth.

Image Events

TimingEvent name (name)
Before / after uploadImageUploading / ImageUpload
Before / after updateImageUpdating / ImageUpdated
Before / after deleteImageDeleting / ImageDelete

General Resource Events

Each resource follows resource prefix + timing suffix, e.g. PageCreating, ContentUpdated.

Backend groupname prefix
PagePage
ViewView
LayoutLayout
CodeCode
MenuMenu
HTML blockHtmlBlock
ContentContent
LabelLabel
ScriptScript
StyleStyle
Operation timingname suffixExample
Before / after createCreating / CreatedPageCreating / PageCreated
Before / after updateUpdating / UpdatedContentUpdating / ContentUpdated
Before / after deleteDeleting / DeletedScriptDeleting / ScriptDeleted

Commerce Events

Backend groupEvent name (name)Typical timing
ProductProductCreating / ProductCreatedBefore / after product create
ProductProductUpdating / ProductUpdatedBefore / after product update
ProductProductDeleting / ProductDeletedBefore / after product delete
ProductProductCopiedAfter product copy
Product categoryProductCategoryCreating / ProductCategoryCreatedBefore / after category create
Product categoryProductCategoryUpdating / ProductCategoryUpdatedBefore / after category update
Product categoryProductCategoryDeleting / ProductCategoryDeletedBefore / after category delete
OrderOrderConfirmedOrder confirmed
OrderOrderDeliveredOrder shipped
OrderOrderCancelledOrder cancelled

Rule Edit Page

Breadcrumb: Action Hooks -> {event display name}. No sidebar menu item; deep links require name (required) and display (breadcrumb).

Rule edit page

New Rule

New Rule dropdown on the toolbar:

TypeValueStructure
IF-ELSE-THENIF-ELSE-THENCondition IF + branches THEN / ELSE (nested rules allowed)
DODORun one or more Code blocks in sequence

If there are no rules when you open the edit page, one IF-ELSE-THEN rule is added by default.

Rule Cards

  • Drag handle on the card title bar to reorder rules for the same event.
  • Delete on the title bar removes the whole rule.

IF-ELSE-THEN

AreaDescription
IFClick the label to open condition editor; multiple conditions shown joined with &&
THEN / ELSENested rule lists; add more IF-ELSE-THEN or DO rules

DO

Lists Code snippet summaries; + adds Code, pencil edits. Code is written in Monaco as KScript (language: typescript, KScript mode). See related links at the end for script objects and APIs.

Code edit dialog

Edit Conditions

Edit conditions
ColumnDescription
Left valueFields available for the current event (BackendRule/ConditionOption), e.g. resource Name, Body, Url, content FolderName, product Title, etc.
OperatorVaries by left-value type (e.g. =, !=, Contains, >, etc.)
Right valueComparison constant

Use + to add condition rows; confirm writes back to the rule if array. Evaluation runs at runtime via ConditionManager.Evaluate.

Save and Leave

Bottom KBottomBar: Back returns to the list; Save calls BackendRule/post (eventName + rules). Unsaved changes prompt before leaving (useSaveTip).

Execution Order (Concept)

  1. Site enableBackendEvents is true.
  2. A backend resource operation fires the matching BackendEvent (e.g. PageCreating, ContentUpdated).
  3. Rules for that event run in list order; IF-ELSE-THEN evaluates conditions then THEN/ELSE; DO runs Code in sequence.

Execution is handled by the site's backend action hook engine, in the order configured on this page.

Typical Workflow

  1. Confirm Advanced tab and Hook On on this page.
  2. New Hook → pick target resource and timing, e.g. ContentUpdated.
  3. Add IF-ELSE-THEN to filter resource fields, or DO for backend actions.
  4. Save, then create, update, or delete the resource in the admin to verify.
  5. On collaborative export, hooks map to BackendRule resources in the site package.

CMS vs API

ScenarioCMSAPI / Template Engine
Which backend operations trigger rulesThis page: hook type picker and rule save
Script actions inside rulesEntry via Code dialog onlyDevelopment -> Code, k.site Code API
Content data after content saveContent events on this pagek.content
Commerce data after product/order eventsProduct / Order events on this pagek.commerce
DocDescription
Settings overviewMenu and sub-routes
Basic Settings · AdvancedenableBackendEvents
Request HooksFront-end request lifecycle events
Development -> CodeKScript code resource entry
Content APIContent read/write
Commerce APIProduct, category, order APIs