An officer only sees applications assigned to their office. The OFFICE_ASSIGNMENT action, usually the breaking action of the system event ASSIGN_OFFICE, sets that office. There are four working types:
The four office assignment types (CODE_FROM_AN_EXPRESSION exists in the enum but is not implemented)
| officeAssignmentType | Args | Use when |
|---|---|---|
CODE_FIXED_OFFICE |
officeId | Every application goes to one office (the demo) |
CODE_FROM_LOCATION |
formFieldKey or formFieldKeys, officeLevel (required) | The office covering the location the applicant chose (district, sector). The engine finds the office of the service's organization at that location and level |
CODE_IN_APPLICATION_OFFICE |
formFieldKey | The applicant picks the office itself in the form (the field holds the office id) |
CODE_APPLICATION_FIELD_CODE |
formFieldKey (officeLevel optional) | A field holds an office code, for example filled by an integration |
Fixed
{
"actionType": "OFFICE_ASSIGNMENT",
"args": {
"officeAssignmentType": "CODE_FIXED_OFFICE",
"officeLevel": "LEVEL_1",
"officeId": "bf863562-a69e-4670-9baf-2b904b2e805d"
}
}
Location
{
"actionType": "OFFICE_ASSIGNMENT",
"args": {
"officeAssignmentType": "CODE_FROM_LOCATION",
"officeLevel": "LEVEL_2",
"formFieldKey": "processingSector.id"
}
}
Sector or embassy
{
"actionType": "OFFICE_ASSIGNMENT",
"args": {
"officeAssignmentType": "CODE_FROM_LOCATION",
"officeLevel": "LEVEL_1",
"formFieldKeys": ["processingSector.id", "embassy.id"]
}
}
nextEvent on an end state fires a system event as soon as the state is reached. The demo chains PAY → PENDING_ASSIGN_OFFICE, whose nextEvent ASSIGN_OFFICE assigns the office and reaches PENDING_OFFICER_PROCESSING. endStateTwo is the alternative end state of a transition, taken when its conditions are true; on APPLY the demo uses it for the free case (price 0: no bill, straight to office assignment).

Original course example: routing by sector or embassy
Office assignment failures
| Error in the logs | Meaning |
|---|---|
OFFICE_NOT_FOUND |
The fixed, in-application or field-code office does not exist on this environment (these three types report every failure this way) |
NO_OFFICE_TO_ASSIGN_RETURNED |
No office of this organization and level covers the chosen location |
MULTIPLE_OFFICES_TO_ASSIGN_RETURNED |
Two offices cover the same location and level |
OFFICE_LEVEL_NOT_PROVIDED_IN_WORKFLOW_CONFIGURATION |
CODE_FROM_LOCATION without officeLevel |
OFFICE_ASSIGNMENT_FIELD_NOT_PROVIDED_IN_WORKFLOW_CONFIGURATION |
CODE_FROM_LOCATION: no formFieldKey(s), or every listed field is empty in the application |
Gotcha · a failed assignment is invisible to the applicant
ASSIGN_OFFICE runs after payment, in the background. If it fails, the engine retries it (3 retries, 60 seconds apart), then the application stays in
PENDING_ASSIGN_OFFICE. The applicant sees "Submitted for Processing" and no officer ever sees it. Lesson D6 reproduces this and shows how to find it in Kibana and re-trigger the event once the office is fixed.
| Item | Matches |
|---|---|
| All tax appeals go to the RRA headquarters | CODE_FIXED_OFFICE |
| Birth certificates go to the district the applicant selected | CODE_FROM_LOCATION |
| The applicant chooses the service centre in a dropdown of offices | CODE_IN_APPLICATION_OFFICE |
| A partner returns the office code in a form field | CODE_APPLICATION_FIELD_CODE |