{"product_id":"generic-state-machine-runtime-for-n8n-data-tables-sub-workflows","title":"Generic State Machine Runtime for n8n Data Tables \u0026 Sub-Workflows","description":"\u003ch3\u003eRun event-sourced state machines in n8n—automatically replay cases, validate transitions, and dispatch sub-workflows\u003c\/h3\u003e\n\u003cp\u003eThis \u003cstrong\u003eGeneric State Machine Runtime for n8n Data Tables \u0026amp; Sub-Workflows\u003c\/strong\u003e is an n8n workflow that replays a case’s event stream from \u003cstrong\u003en8n Data Tables\u003c\/strong\u003e, verifies whether a requested transition is allowed, appends new events safely (including duplicate checks), and—when a target state is configured—\u003cstrong\u003estarts a bound n8n sub-workflow asynchronously\u003c\/strong\u003e to execute state tasks.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eReceives an execution request\u003c\/strong\u003e from another workflow and validates the incoming event (or handles an \u003cem\u003einspect-only\u003c\/em\u003e request) and its identifiers.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eLoads state-machine definitions\u003c\/strong\u003e from an n8n Data Table catalog and validates the machine\/version details.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eReconstructs current state\u003c\/strong\u003e by reading the case’s existing events from an event-stream Data Table and replaying them.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eChecks transition eligibility\u003c\/strong\u003e—either returns current status for inspect, or determines whether the requested transition is allowed.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eAppends accepted events\u003c\/strong\u003e to the case event stream with the \u003cstrong\u003enext sequence number\u003c\/strong\u003e and resolved \u003cstrong\u003ecorrelation\/causation\u003c\/strong\u003e details, unless the event is a duplicate.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eOptionally dispatches a state task\u003c\/strong\u003e: if the entered target state declares a task, it looks up the machine\/version\/task binding and prepares a sub-workflow invocation payload.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eStarts the bound sub-workflow asynchronously\u003c\/strong\u003e when a binding exists; otherwise returns the applied transition result with an \u003cstrong\u003e“unavailable” dispatch reason\u003c\/strong\u003e.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eWorkflow-driven business processes\u003c\/strong\u003e (e.g., order onboarding, case triage) that require strict transition rules and auditable event histories.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eEvent-sourced automations\u003c\/strong\u003e where you must replay state from stored events rather than rely on mutable status fields.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eDecoupled state tasks\u003c\/strong\u003e by dispatching n8n sub-workflows when specific states are entered.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eUses n8n nodes including \u003cstrong\u003eif\u003c\/strong\u003e, \u003cstrong\u003ecode\u003c\/strong\u003e, \u003cstrong\u003eData Table\u003c\/strong\u003e, \u003cstrong\u003eExecute Workflow\u003c\/strong\u003e, and \u003cstrong\u003eExecute Workflow Trigger\u003c\/strong\u003e (plus a \u003cstrong\u003eSticky Note\u003c\/strong\u003e for documentation).\u003c\/li\u003e\n  \u003cli\u003eRequires \u003cstrong\u003ethree Data Tables\u003c\/strong\u003e: machine definitions, case event stream, and task bindings (configure and update Data Table IDs in the Data Table nodes).\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":46160847601843,"sku":"N8N-20414","price":55.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/bgqwrSOMlWjRsr4NtfdQQ_LpZ6JQbZ.png?v=1791191263","url":"https:\/\/buyflowscripts.com\/products\/generic-state-machine-runtime-for-n8n-data-tables-sub-workflows","provider":"N8N Commerce","version":"1.0","type":"link"}