Skip to content

State Machines, Custom Types & Panel Actions

Domain entities often follow strict operational lifecycles — work orders moving from triage to on-site completion, or clinic appointments progressing from scheduled booking to checked-in consultation. State Machine Studio, Custom Domain Types, and Panel Action Buttons enforce those rules consistently in both backend endpoints and frontend controls.


1. Lifecycle Statecharts in State Machine Studio

Mark any String or enumerated attribute with the State governance badge in the ERD Entity Card or Object Browser -> Architecture & Integration -> State Machines to open its Lifecycle Statechart:

  • Initial & Terminal States: Designate the entry state (INITIAL) and one or more completion states (FINAL -> END), styled with distinct color badges (blue, amber, purple, indigo, emerald, rose).
  • Auto-Layout & Custom Positioning: Toggle between ⇄ Horizontal and vertical flow orientations, click ⚡ Auto-Layout for instant topological arrangement, or drag state nodes into custom positions (saved automatically with Undo / Redo support).
  • Add Transition & Multi-Origin Support: Click + Add Transition or drag between state handles to connect one or multiple allowed origin states to a destination state.
State Machine Studio displaying the WorkOrder.status Lifecycle Statechart from Triaged through Assigned, In Transit, On Site, and Completed

WorkOrder.status Lifecycle Statechart showing initial state Triaged, four guarded transitions, and terminal state Completed.


2. Transitions, Role Guards, Payloads & Emitted Triggers

Select any transition edge on the statechart to configure its execution contract inside the State Inspector Drawer:

  • Trigger Modalities: Combine Manual (button click or API action), Schedule (time-based automation such as no-show detection), and Event (triggered by another entity).
  • Allowed Origin States & Destination State: Select one or more valid source states ([Scheduled, CheckedIn] -> Cancelled) and enforce valid state paths across backend mutations.
  • Role Guards (guards.roles): Restrict who can execute each transition (Dispatcher, Practitioner, Technician, Receptionist, Administrator).
  • Required Transition Payloads: Prompt for mandatory contextual fields on transition — such as resolutionSummary when completing a work order or cancellationReason when cancelling an appointment.
  • Emits Interface Trigger & 10 Lifecycle Action Points: Emit downstream events (WorkOrder.Completed, Appointment.Completed) via emitsTrigger and attach custom rules to any of the transition’s 10 action points (ON_REQUEST_INIT, ON_AUTHORIZE, PRE_VALIDATE_STATE, POST_VALIDATE_STATE, PRE_TRANSITION, POST_TRANSITION, PRE_EMIT_TRIGGER, POST_EMIT_TRIGGER, ON_SUCCESS, ON_FAILURE).

3. Reusable Custom Types, Panel Actions & Application Menu

Three companion tools finish the interactive experience around lifecycles:

  1. Custom Domain Types (Object Browser -> Data & Domain -> Types): Author reusable Scalar types (decimal precision/scale, min/max bounds, regex patterns, placeholders, display formats) and Enum types (coded option lists with color pills such as DispatchPriority or OrderStatus) so entities and form inputs share one domain contract.
  2. Panel Action Buttons (EVALUATE_ACTION_STATE): Add custom toolbar or row action buttons directly onto grids, Kanban cards, calendars, or drawers in Screen Stitcher. Bind each button to a state transition, custom service function, or signal flow, and control visibility/disabled state per record using EVALUATE_ACTION_STATE.
  3. Application Menu Designer (Application Menu -> ⚙️ Edit): Organize navigation groups and sidebar ordering cleanly, mapping role visibility and quick Cmd+K command search across every composite screen and entity register.

4. Guided Example — Enforcing Lifecycle Transitions & Guards

Guided Build · Step 5 of 8
Statecharts, Role Guards, Transition Payloads & Custom Domain Types
Previously in this build: In Step 4 you built FieldDispatchCommandCenter with KPI telemetry, Crew Timetable, Status Pipeline, and slide-over Work Order drawers.
✅ Checkpoint:WorkOrder.status permits only valid dispatch transitions with role guards and emits WorkOrder.Completed on closeout.
Primary TrackEnforce the 5-stage WorkOrder lifecycle (Triaged -> Assigned -> InTransit -> OnSite -> Completed) with technician role guards, required completion resolution notes, and shared DispatchPriority tiers.
  1. Open WorkOrder.status in State Machine Studio: Select WorkOrder.status under Object Browser -> State Machines (or click its State pill in Diagram View) to open the 5-state horizontal statechart; use + Add Transition or drag state handles when adding new edges.
  2. Configure & Inspect Role Guards and Payloads: Click Assign Technician to configure role guards (Dispatcher, OperationsManager, Administrator) in the State Inspector Drawer, then select Complete Work Order to require resolutionSummary and emit WorkOrder.Completed.
  3. Review DispatchPriority Custom Type & Menu Order: Open Object Browser -> Types -> DispatchPriority to inspect Critical (4h), High (8h), Normal (24h), and Scheduled badges, then organize Dispatch & Operations screens in Application Menu -> ⚙️ Edit.
WorkOrder.status Lifecycle Statechart enforcing valid dispatch progression from Triaged to Completed.