Skip to content

Account Request Routing (Case Step Example)

This example demonstrates the case step type for policy-based routing. When a user requests access to a system, the approval path depends on their classification.

Scenario

User Classification Approval Path
App X Admin Provisioned immediately (no approval)
Regular Employee Requires manager approval
External Partner Requires two sponsor approvals
Other Rejected as unsupported

Variables

Name Type Required Description
user user yes The requesting user
userCategory string yes Classification of the requester
sponsor1 user no First sponsor for external partner requests
sponsor2 user no Second sponsor for external partner requests

Steps

1. "Start" — Start

Entry point.

2. "Route by Category" — Case

Config Field Value
Selector userCategory
Cases appXAdmin, employee, externalPartner
Default → Unsupported Classification

The case step reads userCategory and routes to the first matching arm. If no arm matches, the default transition fires.

Transitions:

  • case:appXAdmin → Auto Provision
  • case:employee → Manager Approval
  • case:externalPartner → Sponsor Approval
  • default → Unsupported Classification

3a. "Auto Provision" — Action

Immediately provisions the account.

3b. "Manager Approval" — Approval

Requires the user's manager to approve the request.

3c. "Sponsor Approval" — Approval

Requires two internal sponsors to approve the request.

3d. "Unsupported Classification" — Notification

Notifies the requester that their classification is not supported.

4. "End" — End

JSON Definition

{
  "name": "Account Request Routing",
  "description": "Routes account requests based on user classification",
  "category": "user",
  "subjectVariable": "user",
  "trigger": { "types": ["manual"] },
  "variables": [
    { "name": "user", "type": "user", "required": true, "description": "The requesting user" },
    {
      "name": "userCategory",
      "type": "string",
      "required": true,
      "description": "Classification of the requester"
    },
    {
      "name": "sponsor1",
      "type": "user",
      "required": false,
      "description": "First sponsor for external partner requests"
    },
    {
      "name": "sponsor2",
      "type": "user",
      "required": false,
      "description": "Second sponsor for external partner requests"
    }
  ],
  "steps": [
    {
      "id": "start",
      "name": "Start",
      "type": "start",
      "config": {},
      "transitions": [{ "on": "success", "goto": "route" }]
    },
    {
      "id": "route",
      "name": "Route by Category",
      "type": "case",
      "config": {
        "selector": "userCategory",
        "cases": [
          { "when": "appXAdmin", "description": "System administrator" },
          { "when": "employee", "description": "Regular employee" },
          { "when": "externalPartner", "description": "External partner" }
        ]
      },
      "transitions": [
        { "on": "case:appXAdmin", "goto": "auto_provision" },
        { "on": "case:employee", "goto": "manager_approval" },
        { "on": "case:externalPartner", "goto": "sponsor_approval" },
        { "on": "default", "goto": "unsupported" }
      ]
    },
    {
      "id": "auto_provision",
      "name": "Auto Provision",
      "type": "action",
      "config": {},
      "transitions": [{ "on": "success", "goto": "end" }]
    },
    {
      "id": "manager_approval",
      "name": "Manager Approval",
      "type": "approval",
      "config": { "approvers": ["manager:{{user.id}}"] },
      "transitions": [
        { "on": "success", "goto": "end" },
        { "on": "error", "goto": "end" }
      ]
    },
    {
      "id": "sponsor_approval",
      "name": "Sponsor Approval",
      "type": "approval",
      "config": { "approvers": ["{{sponsor1.id}}", "{{sponsor2.id}}"] },
      "transitions": [
        { "on": "success", "goto": "end" },
        { "on": "error", "goto": "end" }
      ]
    },
    {
      "id": "unsupported",
      "name": "Unsupported Classification",
      "type": "notification",
      "config": {
        "recipientType": "internal",
        "recipientUserId": "{{user.id}}",
        "body": "Your user classification is not supported for this request."
      },
      "transitions": [{ "on": "success", "goto": "end" }]
    },
    {
      "id": "end",
      "name": "End",
      "type": "end",
      "config": {},
      "transitions": []
    }
  ],
  "onError": "stop"
}

When to Use case vs condition

  • Use case when routing on a single variable with 3+ possible values — it produces one node instead of a chain of binary conditions.
  • Use condition for boolean checks, numeric thresholds, or comparisons between two variables.
  • Avoid using case for binary decisions — a condition step is simpler and more explicit.