Skip to main content

Workflow Engine Enhancement

Issue: #84 Branch: feature/84/workflow-engine-enhancement PR: #93

Overview

Adds a zero-code visual workflow builder that allows administrators to define process steps, status transitions, guards, and automatic actions per zaaktype. Caseworkers see available transitions on the case detail view, filtered by role and guard evaluation.

Architecture

Backend

  • Schema: workflowTemplate added to lib/Settings/procest_register.json
    • Fields: title, description, caseTypeId, version, isActive, isDraft, steps (JSON array), transitions (JSON array), guards (JSON array), automaticActions (JSON array)

Frontend

  • Pinia store: src/store/modules/workflow.js

    • CRUD on workflowTemplate objects via OpenRegister
    • Guard evaluation (4 types: role-check, field-value, date-range, expression)
    • Version management (draft → publish)
    • Import/export as JSON
    • Automatic action dispatch (email via n8n, task creation, webhooks, field update, notification, subcase)
  • Visual Editor: src/views/settings/WorkflowEditor.vue

    • SVG canvas with draggable status nodes
    • Connection ports for transitions
    • Pan/zoom via CSS transform
  • Configuration Panels:

    • StepConfigPanel.vue: checklist editor, guard configuration
    • TransitionConfigPanel.vue: action configuration per transition
  • Case Detail Integration: WorkflowTransitions.vue: shows available transitions filtered by role/guards

Guards

TypeDescription
role-checkOnly users with specified role can perform transition
field-valueTransition available only when a case field has a given value
date-rangeTransition available within a date window
expressionCustom JS expression evaluated against case data

Automatic Actions (per transition)

TypeDescription
send-emailTrigger n8n webhook with email payload
create-taskAutomatically create a task assigned to a role
webhookCall an external webhook URL
update-fieldUpdate a case field value
send-notificationSend Nextcloud notification
create-subcaseCreate a linked sub-case of a given type

Testing

Unit tests are in tests/Unit/Settings/WorkflowEngineSchemaTest.php. They verify:

  • procest_register.json is valid JSON and follows OpenAPI structure
  • workflowTemplate schema is registered with required properties (steps, transitions)
  • All core case management schemas remain present after the migration