Conditional Routing Matrix
Route work items to different people or queues based on multiple criteria evaluated together. More maintainable than nested if-else chains.
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:
| Department | Amount Range | Region | Route To |
|---|---|---|---|
| Marketing | $0 – $5,000 | Any | Marketing Manager |
| Marketing | $5,001 – $25,000 | US | Marketing Director |
| Marketing | $5,001 – $25,000 | EMEA | EMEA Marketing Lead |
| Marketing | $25,001+ | Any | CMO |
| Engineering | $0 – $10,000 | Any | Engineering Manager |
| Engineering | $10,001+ | Any | VP Engineering |
| * | $100,001+ | Any | CFO |
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:
- Read the request's attributes (department, amount, region)
- Query the routing table for matching rows
- Filter: match each criterion, treat wildcards as "always match"
- If multiple matches, take the one with highest priority
- 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:
- Assign the task to the specified approver
- Set the escalation contact from the table
- 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
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
Saga with Compensating Transactions
Coordinate a multi-step business transaction that spans several systems by pairing each step with a rollback action. If a later step fails, run the rollbacks in reverse to restore a consistent state.
State Machine Workflow
Model a business process as a set of defined states with explicit transitions between them. Unlike linear workflows, items can move forwards, backwards, and loop — matching how real business processes actually behave.
Fan-Out / Fan-In
Split a workload into parallel branches, process them simultaneously, then aggregate the results. Dramatically reduces processing time for batch operations.