Skip to content

Approval Workflows ​

CDX approvals are a durable workflow family, not a graph template you rebuild in each app.

Canonical Definition ​

ApprovalWorkflowHandlerFactory in cdx_workflow_templates creates the durable handler. It covers:

  • zero-level auto-approval;
  • single-level and multi-level chains;
  • rejection, revision, resubmission, cancellation, and failure;
  • domain dispatch through item_schema_type;
  • typed start and effect contracts (ApprovalStart, ApprovalEffectOutcome).

The explicitly separate graph approval template remains available through the Legacy* graph surface. New durable integrations use the handler factory.

dart
final approvalFactory = ApprovalWorkflowHandlerFactory.standard(
  code: 'directory.entity-master-approval',
  version: 1,
  digest: 'directory.entity-master-approval:v1',
);

final approvalHandler = approvalFactory.buildHandler();

Starting an Approval ​

Product APIs start the durable version through the workflow service with a typed start envelope. They do not call LegacyWorkflowEngine.startWorkflow for new versions.

Audience is persisted on each work command. Completing an approval decision goes through respond with the registered work response schema.

Domain Effects ​

Outcome handlers (onApproved, onRejected, onRevisionRequested, onCancelled, onFailed, onResubmitted) are versioned operations. They must be idempotent. They must not rethrow in a way that shadows the original workflow failure.

Inbox ​

cdx_feature_workflows renders the sealed WorkAction list produced by the server. Flutter does not reconstruct approval routing.

See Also ​