Objective: Route data to multiple paths based on the Department field.
When clicking "Execute Workflow" → Set Department → Switch → HR Path / IT Path / Sales Path[ ] Open your workflow Lab 5 - Traffic Cop.
[ ] In Set Department set the field Department to HR for the first test.
[ ] In the Switch node set the value to check as ={{ $json.Department }}.
[ ] Configure three rules in the Switch node for:
HR
IT
Sales
and connect them to HR Path, IT Path, Sales Path.
[ ] Execute the workflow and confirm the item goes to HR Path.
[ ] Change Department in Set Department to IT, run again, and confirm it now goes to IT Path.
[ ] Change Department to Sales, run again, and confirm it goes to Sales Path.

{
"nodes": [
{
"parameters": {
"content": "## Lab 5: Traffic cop (Switch node)\\n1. **Add 'Edit Fields' Node:** Create a field `Department` = `HR`.\\n2. **Add 'Switch' Node:** Route based on `{{ $json.Department }}`.\\n3. **Create 3 Paths:** HR, IT, Sales.\\n4. **Test:** Change input to 'IT' and watch the path change.",
"height": 732,
"width": 1090,
"color": 4
},
"id": "27a56306-2b62-42a5-afd4-c824fb9d0580",
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
-592,
-272
],
"name": "Instructions"
},
{
"parameters": {},
"id": "ca3633b2-ac4a-4e07-82e6-114448bbaeb2",
"name": "When clicking \\"Execute Workflow\\"",
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
-464,
96
]
},
{
"parameters": {
"fields": {
"values": [
{
"name": "Department",
"stringValue": "IT"
}
]
},
"options": {}
},
"id": "15ff019b-267f-4646-a134-efc8d8396561",
"name": "Set Department",
"type": "n8n-nodes-base.set",
"typeVersion": 3,
"position": [
-240,
96
]
},
{
"parameters": {
"dataType": "string",
"value1": "={{ $json.Department }}",
"rules": {
"rules": [
{
"value2": "HQ",
"outputKey": "HQ"
},
{
"value2": "IT",
"outputKey": "IT"
},
{
"value2": "Sales",
"outputKey": "Sales"
}
]
},
"fallbackOutput": 0
},
"id": "cfe7e80b-9047-463e-a67b-a049de915f87",
"name": "Switch",
"type": "n8n-nodes-base.switch",
"typeVersion": 2,
"position": [
-16,
80
]
},
{
"parameters": {
"options": {}
},
"id": "1206662b-18cc-4cb5-bd3a-0f6adf790fb6",
"name": "HR Path",
"type": "n8n-nodes-base.set",
"typeVersion": 3,
"position": [
208,
-96
]
},
{
"parameters": {
"options": {}
},
"id": "39572f5f-0e2f-430a-a447-96232ea3570b",
"name": "IT Path",
"type": "n8n-nodes-base.set",
"typeVersion": 3,
"position": [
208,
96
]
},
{
"parameters": {
"options": {}
},
"id": "4d31c4bb-1fbd-4907-b307-2b91e598660a",
"name": "Sales Path",
"type": "n8n-nodes-base.set",
"typeVersion": 3,
"position": [
208,
288
]
}
],
"connections": {
"When clicking \\"Execute Workflow\\"": {
"main": [
[
{
"node": "Set Department",
"type": "main",
"index": 0
}
]
]
},
"Set Department": {
"main": [
[
{
"node": "Switch",
"type": "main",
"index": 0
}
]
]
},
"Switch": {
"main": [
[
{
"node": "HR Path",
"type": "main",
"index": 0
}
],
[
{
"node": "IT Path",
"type": "main",
"index": 0
}
],
[
{
"node": "Sales Path",
"type": "main",
"index": 0
}
]
]
}
},
"pinData": {},
"meta": {
"instanceId": "82cc682d3f33add4f11a78e1f29750bf4ba4e425478ba4b17330f9bf15960ec6"
}
}