Workflow Patterns

Reusable patterns for common workflow shapes — approvals, payments, rejections, and integration sequences.

Common workflow patterns with complete JSON matching the real WorkflowTransitionDto structure.

See Workflow Structure for field reference and Workflow Actions for action types.

Available Events

Only use events from this list. Do not invent event names.

EventWho triggers itWhat it does
APPLYCitizen / AgentSubmits the application form; moves NEW → SUBMITTED
PAYSystemConfirms payment; advances from PAYMENT_PENDING
EXPIRE_PAYMENTSystemPayment expired; moves PAYMENT_PENDING → terminal expired state
INITIATE_PUSHSystemTriggers an integration call; starts or continues the integration chain
PUSHSystem / PartnerCallback confirming an async integration completed; advances the chain
ASSIGN_OFFICESystemAssigns an office using the OFFICE_ASSIGNMENT breakingAction
APPROVEOfficerOfficer approves the application
APPROVE_WITH_FORMOfficerOfficer approves and fills in additional form data
REJECTOfficerOfficer rejects the application
ESCALATEOfficerWorks like APPROVE — advances the application to the next processing level
REQUEST_FOR_ACTIONOfficer / PartnerSends the application back to the applicant for corrections
SUBMIT_RFACitizen / AgentApplicant resubmits after a REQUEST_FOR_ACTION
SET_APPOINTMENTOfficer / SystemSets an appointment for the applicant
TRANSITIONSystemMoves the application from one state to another (generic state change)

1. Simple Approval

[
  {
    "startState": "SUBMITTED",
    "event": "APPROVE",
    "endStateOne": {
      "stateCode": "APPROVED",
      "stateName": "Approved",
      "stateNames": { "en": "Approved", "rw": "Byemejwe" },
      "breakingAction": null,
      "breakingActions": [],
      "nonBreakingActions": [
        {
          "actionType": "NOTIFICATION",
          "args": {
            "notificationType": "DYNAMIC",
            "dynamicTemplate": { "en": { "templateCode": "TODO: approval_notification_en" } }
          }
        },
        {
          "actionType": "GENERATE_CERTIFICATE",
          "args": {
            "certificateName": "Certificate",
            "certificateTemplateCode": { "en": "TODO: certificate_template_en" }
          }
        }
      ],
      "nextEvent": null,
      "position": { "x": 400, "y": 100 }
    },
    "endStateTwo": null,
    "endStateCondition": null,
    "authorisation": {
      "authorisedRoles": ["REVIEWER"],
      "authorisedUsers": null,
      "systemAuthorised": null
    },
    "position": { "x": 200, "y": 100 },
    "eventNames": { "en": "Approve", "rw": "Emeza" },
    "eventConfigs": null
  },
  {
    "startState": "SUBMITTED",
    "event": "REJECT",
    "endStateOne": {
      "stateCode": "REJECTED",
      "stateName": "Rejected",
      "stateNames": { "en": "Rejected", "rw": "Byanzwe" },
      "breakingAction": null,
      "breakingActions": [
        {
          "actionType": "NOTIFICATION",
          "args": {
            "notificationType": "DYNAMIC",
            "dynamicTemplate": { "en": { "templateCode": "TODO: rejection_notification_en" } }
          }
        }
      ],
      "nonBreakingActions": [],
      "nextEvent": null,
      "position": { "x": 400, "y": 300 }
    },
    "endStateTwo": null,
    "endStateCondition": null,
    "authorisation": {
      "authorisedRoles": ["REVIEWER"],
      "authorisedUsers": null,
      "systemAuthorised": null
    },
    "position": { "x": 200, "y": 300 },
    "eventNames": { "en": "Reject", "rw": "Hagarika" },
    "eventConfigs": null
  }
]

2. Multi-Level Approval

[
  {
    "startState": "SUBMITTED",
    "event": "FORWARD",
    "endStateOne": {
      "stateCode": "UNDER_REVIEW",
      "stateName": "Under Review",
      "stateNames": { "en": "Under Review", "rw": "Irasuzumwa" },
      "breakingAction": null,
      "breakingActions": [],
      "nonBreakingActions": [
        {
          "actionType": "OFFICE_ASSIGNMENT",
          "args": {
            "officeAssignmentType": "FORM_FIELD",
            "formFieldKey": "TODO: location_field_key",
            "officeLevel": "DISTRICT"
          }
        }
      ],
      "nextEvent": null,
      "position": { "x": 300, "y": 200 }
    },
    "endStateTwo": null,
    "endStateCondition": null,
    "authorisation": { "authorisedRoles": null, "authorisedUsers": null, "systemAuthorised": true },
    "position": { "x": 150, "y": 200 },
    "eventNames": { "en": "Forward for Review" },
    "eventConfigs": null
  },
  {
    "startState": "UNDER_REVIEW",
    "event": "APPROVE",
    "endStateOne": {
      "stateCode": "APPROVED",
      "stateName": "Approved",
      "stateNames": { "en": "Approved", "rw": "Byemejwe" },
      "breakingAction": null,
      "breakingActions": [],
      "nonBreakingActions": [
        {
          "actionType": "NOTIFICATION",
          "args": {
            "notificationType": "DYNAMIC",
            "dynamicTemplate": { "en": { "templateCode": "TODO: approval_en" } }
          }
        },
        {
          "actionType": "GENERATE_CERTIFICATE",
          "args": {
            "certificateName": "Certificate",
            "certificateTemplateCode": { "en": "TODO: cert_template" }
          }
        }
      ],
      "nextEvent": null,
      "position": { "x": 600, "y": 100 }
    },
    "endStateTwo": null,
    "endStateCondition": null,
    "authorisation": {
      "authorisedRoles": ["REVIEWER"],
      "authorisedUsers": null,
      "systemAuthorised": null
    },
    "position": { "x": 450, "y": 100 },
    "eventNames": { "en": "Approve" },
    "eventConfigs": null
  },
  {
    "startState": "UNDER_REVIEW",
    "event": "REJECT",
    "endStateOne": {
      "stateCode": "REJECTED",
      "stateName": "Rejected",
      "stateNames": { "en": "Rejected", "rw": "Byanzwe" },
      "breakingAction": null,
      "breakingActions": [
        {
          "actionType": "NOTIFICATION",
          "args": {
            "notificationType": "DYNAMIC",
            "dynamicTemplate": { "en": { "templateCode": "TODO: rejection_en" } }
          }
        }
      ],
      "nonBreakingActions": [],
      "nextEvent": null,
      "position": { "x": 600, "y": 300 }
    },
    "endStateTwo": null,
    "endStateCondition": null,
    "authorisation": {
      "authorisedRoles": ["REVIEWER"],
      "authorisedUsers": null,
      "systemAuthorised": null
    },
    "position": { "x": 450, "y": 300 },
    "eventNames": { "en": "Reject" },
    "eventConfigs": null
  },
  {
    "startState": "UNDER_REVIEW",
    "event": "ESCALATE",
    "endStateOne": {
      "stateCode": "ESCALATED",
      "stateName": "Escalated",
      "stateNames": { "en": "Escalated" },
      "breakingAction": null,
      "breakingActions": [],
      "nonBreakingActions": [
        {
          "actionType": "INTERNAL_NOTIFICATION",
          "args": {
            "notificationType": "DYNAMIC",
            "dynamicTemplate": { "en": { "templateCode": "TODO: escalation_internal_en" } },
            "internalEmailNotificationRecipients": ["TODO: supervisor_email"]
          }
        }
      ],
      "nextEvent": null,
      "position": { "x": 450, "y": 500 }
    },
    "endStateTwo": null,
    "endStateCondition": null,
    "authorisation": {
      "authorisedRoles": ["REVIEWER"],
      "authorisedUsers": null,
      "systemAuthorised": null
    },
    "position": { "x": 300, "y": 500 },
    "eventNames": { "en": "Escalate" },
    "eventConfigs": null
  },
  {
    "startState": "ESCALATED",
    "event": "APPROVE",
    "endStateOne": {
      "stateCode": "APPROVED",
      "stateName": "Approved",
      "stateNames": { "en": "Approved", "rw": "Byemejwe" },
      "breakingAction": null,
      "breakingActions": [],
      "nonBreakingActions": [
        {
          "actionType": "NOTIFICATION",
          "args": {
            "notificationType": "DYNAMIC",
            "dynamicTemplate": { "en": { "templateCode": "TODO: approval_en" } }
          }
        },
        {
          "actionType": "GENERATE_CERTIFICATE",
          "args": {
            "certificateName": "Certificate",
            "certificateTemplateCode": { "en": "TODO: cert_template" }
          }
        }
      ],
      "nextEvent": null,
      "position": { "x": 700, "y": 400 }
    },
    "endStateTwo": null,
    "endStateCondition": null,
    "authorisation": {
      "authorisedRoles": ["APPROVER"],
      "authorisedUsers": null,
      "systemAuthorised": null
    },
    "position": { "x": 600, "y": 400 },
    "eventNames": { "en": "Approve" },
    "eventConfigs": null
  },
  {
    "startState": "ESCALATED",
    "event": "REJECT",
    "endStateOne": {
      "stateCode": "REJECTED",
      "stateName": "Rejected",
      "stateNames": { "en": "Rejected", "rw": "Byanzwe" },
      "breakingAction": null,
      "breakingActions": [
        {
          "actionType": "NOTIFICATION",
          "args": {
            "notificationType": "DYNAMIC",
            "dynamicTemplate": { "en": { "templateCode": "TODO: rejection_en" } }
          }
        }
      ],
      "nonBreakingActions": [],
      "nextEvent": null,
      "position": { "x": 700, "y": 600 }
    },
    "endStateTwo": null,
    "endStateCondition": null,
    "authorisation": {
      "authorisedRoles": ["APPROVER"],
      "authorisedUsers": null,
      "systemAuthorised": null
    },
    "position": { "x": 600, "y": 600 },
    "eventNames": { "en": "Reject" },
    "eventConfigs": null
  }
]

On this page