Patterns
intermediateorchestration

Conditional Routing Matrix

Route work items to different people or queues based on multiple criteria evaluated together. More maintainable than nested if-else chains.

Views13
BPMN 2.0
On this page

Visual Flow

Rendering diagram…

When to Use This Pattern

Use a routing matrix when:

  • Work items need to go to different people/teams based on multiple criteria
  • The routing rules are complex enough that nested if-else becomes unreadable
  • Business users need to update routing rules without modifying the workflow
  • You have combinations of criteria (department + amount + region → specific approver)

How It Works

Instead of hardcoding routing logic in the workflow, store it in a lookup table:

DepartmentAmount RangeRegionRoute To
Marketing$0 – $5,000AnyMarketing Manager
Marketing$5,001 – $25,000USMarketing Director
Marketing$5,001 – $25,000EMEAEMEA Marketing Lead
Marketing$25,001+AnyCMO
Engineering$0 – $10,000AnyEngineering Manager
Engineering$10,001+AnyVP Engineering
*$100,001+AnyCFO

The workflow reads this table at runtime and routes accordingly.

Implementation Guide

Step 1: Design the Routing Table

Create a SharePoint list, database table, or Excel file with columns for each criterion:

  • Criteria columns: Department, Amount Min, Amount Max, Region, Request Type, etc.
  • Wildcard support: Use "*" or blank to mean "any value"
  • Output columns: Approver Email, Approver Name, Escalation Contact
  • Priority column: When multiple rows match, use the highest priority
Step 2: Query the Table at Runtime

When a request arrives:

  1. Read the request's attributes (department, amount, region)
  2. Query the routing table for matching rows
  3. Filter: match each criterion, treat wildcards as "always match"
  4. If multiple matches, take the one with highest priority
  5. If no match, use a default route (and alert an admin to update the table)
Step 3: Route the Work Item

Using the matched row:

  1. Assign the task to the specified approver
  2. Set the escalation contact from the table
  3. Apply any other routing parameters (SLA, priority level)
Step 4: Maintain the Table

Give business users a simple interface to manage routing rules:

  • A SharePoint list with column validation
  • A GalleryAdmin page with CRUD operations
  • An Excel file in a shared location (less ideal but works)

Example: Purchase Request Routing

A new purchase request arrives with:

  • Department: Marketing
  • Amount: $12,000
  • Region: EMEA

The workflow queries the routing table and finds:

  • Row match: Marketing, $5,001–$25,000, EMEA → EMEA Marketing Lead

The task is assigned to the EMEA Marketing Lead with appropriate SLA.

Tips & Best Practices

Tip

The power of this pattern is that business users can change routing rules by editing a table, without touching the workflow. This is a huge win for maintainability.

  • Always have a fallback rule. A catch-all row with wildcards in every criterion column ensures that every request gets routed somewhere.
  • Log the matched rule. Store which routing rule was applied in the request's history. This helps with auditing and debugging.
  • Validate the table. Periodically check for common issues: overlapping rules, missing approver emails, inactive employees in the approver column.
  • Test with edge cases. The asterisk/wildcard matching logic is where bugs hide. Test with boundary amounts, missing fields, and unexpected combinations.

Related patterns