Alternativa de nodo Switch v1.0
Este es unautomatización que contiene 11 nodos.Utiliza principalmente nodos como Set, Switch, StopAndError, ManualTrigger. Implementación de una alternativa de nodo Switch a prueba de fallos para garantizar la fiabilidad del control del flujo de trabajo
- •No hay requisitos previos especiales, puede importar y usarlo directamente
Nodos utilizados (11)
Categoría
{
"id": "0j8KmcwbaWnKR8Vb",
"meta": {
"instanceId": "b647f0ebd8b6d139faf3e6bcf7eb4e75bf2254b55299893f22d4aabb50ef1e9e",
"templateCredsSetupCompleted": true
},
"name": "Fallback on any Switch Node v1.0",
"tags": [
{
"id": "bPkcrK17uG3HMk6T",
"name": "🏷️ Template",
"createdAt": "2025-09-03T06:52:38.087Z",
"updatedAt": "2025-09-03T06:52:38.087Z"
},
{
"id": "v4mArge40MnxFxw5",
"name": "🟢 operational",
"createdAt": "2025-08-10T13:32:11.849Z",
"updatedAt": "2025-08-19T17:01:08.590Z"
}
],
"nodes": [
{
"id": "5432e67b-4dc8-4675-bd4f-9791180856af",
"name": "Sticky Note",
"type": "n8n-nodes-base.stickyNote",
"position": [
-96,
-880
],
"parameters": {
"color": 7,
"width": 224,
"height": 576,
"content": "## Webhook trigger\n- freely accessible in the internet if not protected\n- **SHOULD be protected** as good as possible for any serious n8n usage!!!\n"
},
"typeVersion": 1
},
{
"id": "94ab34de-3164-49ae-9601-97bebcf72e1d",
"name": "Sticky Note7",
"type": "n8n-nodes-base.stickyNote",
"position": [
-192,
-1216
],
"parameters": {
"color": 4,
"width": 1488,
"height": 992,
"content": "# Example Setup\n- For any Switch node the \"ohter\"/ fallback option should allways be used unless you really know what you do"
},
"typeVersion": 1
},
{
"id": "17311961-275d-49de-88d0-50cd58378959",
"name": "Sticky Note1",
"type": "n8n-nodes-base.stickyNote",
"position": [
432,
-1056
],
"parameters": {
"color": 7,
"width": 528,
"height": 752,
"content": "## Allways activate the Fallback Option!\n\nIf you have considered **ALL** cases (even if things change in future)\n- **all OK:** the fallback will never fire \n- **if things go wrong:** the fallback saves you hours of debugging work as is will not fail silently!\n\nAnd believe me: \nat some point things will go wrong sooner or later"
},
"typeVersion": 1
},
{
"id": "e080f5df-0dc5-4759-a454-dbdefd09ba82",
"name": "Sticky Note2",
"type": "n8n-nodes-base.stickyNote",
"position": [
-544,
-1216
],
"parameters": {
"width": 288,
"height": 992,
"content": "# 🚦 START Here\n\n## Switch Node Best Practice\n\nThe Switch node is powerful — but easy to misconfigure. Without a proper fallback, things can silently break. 🧨\n\nCommon pitfalls:\n- The value is null or undefined due to earlier workflow errors\n- Case mismatches (\"Yes\" vs \"yes\")\n- Type mismatches (3 as number vs \"3\" as string)\n- Forgotten or outdated conditions\n\n## ➡️ Best Practice:\nAlways enable the **“Fallback” option** and connect it to an Error or Notify node. This ensures misrouted executions don't silently fail — they alert you instead.\n\n**Protect your workflow logic, and save yourself hours of debugging. 🛠️**"
},
"typeVersion": 1
},
{
"id": "e6feed01-0eb5-4ff0-b11c-209f871770ab",
"name": "Switch Best Practice",
"type": "n8n-nodes-base.switch",
"position": [
528,
-704
],
"parameters": {
"rules": {
"values": [
{
"outputKey": "caseOne",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "c9d2e4fd-2fb6-459d-8eb5-ed49d27f1054",
"operator": {
"type": "number",
"operation": "equals"
},
"leftValue": {},
"rightValue": 1
}
]
},
"renameOutput": true
},
{
"outputKey": "caseTwo",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "dacab787-df1c-4b26-bdcd-ea1d169b7935",
"operator": {
"type": "number",
"operation": "equals"
},
"leftValue": {},
"rightValue": 2
}
]
},
"renameOutput": true
},
{
"outputKey": "caseThree",
"conditions": {
"options": {
"version": 2,
"leftValue": "",
"caseSensitive": true,
"typeValidation": "strict"
},
"combinator": "and",
"conditions": [
{
"id": "cf5fe10c-beb5-43ba-85aa-6e8f693df9a3",
"operator": {
"type": "number",
"operation": "equals"
},
"leftValue": {},
"rightValue": 3
}
]
},
"renameOutput": true
}
]
},
"options": {
"fallbackOutput": "extra"
}
},
"typeVersion": 3.3
},
{
"id": "48a3601f-f1b1-4702-aee0-e3170448398c",
"name": "Case 1 - Do whatever your workflow should do",
"type": "n8n-nodes-base.noOp",
"position": [
1056,
-960
],
"parameters": {},
"typeVersion": 1
},
{
"id": "f24d8323-21dd-4a46-8b46-7963e3117ba6",
"name": "Case 2 - Do whatever your workflow should do",
"type": "n8n-nodes-base.noOp",
"position": [
1056,
-768
],
"parameters": {},
"typeVersion": 1
},
{
"id": "79fdfe12-88d2-4ead-b309-80ba869e7673",
"name": "Case 3 - Do whatever your workflow should do",
"type": "n8n-nodes-base.noOp",
"position": [
1056,
-576
],
"parameters": {},
"typeVersion": 1
},
{
"id": "c6011620-2dfb-4e0e-8770-18589b58dd0d",
"name": "When clicking ‘Execute workflow’",
"type": "n8n-nodes-base.manualTrigger",
"position": [
-32,
-672
],
"parameters": {},
"typeVersion": 1
},
{
"id": "ffc767d3-b651-4f9f-b0ae-ea1b0b80eccf",
"name": "Dummy Data",
"type": "n8n-nodes-base.set",
"position": [
272,
-672
],
"parameters": {
"options": {},
"assignments": {
"assignments": [
{
"id": "93be0a9f-15d8-4265-ae3e-f6ffcdefd794",
"name": "caseOne",
"type": "number",
"value": 42
},
{
"id": "87cc796c-376d-428a-abdc-9de092f3577c",
"name": "caseTwo",
"type": "number",
"value": 42
},
{
"id": "7812fa72-6bb2-46f3-b437-a0100b40a43b",
"name": "caseThree",
"type": "number",
"value": 42
}
]
}
},
"typeVersion": 3.4
},
{
"id": "5dcddab3-babe-4694-837d-b0831b63c9bd",
"name": "Switch Case NOT defined",
"type": "n8n-nodes-base.stopAndError",
"position": [
752,
-480
],
"parameters": {
"errorMessage": "=The Switch Case in Workflow \"{{ $workflow.name }}\" was not defined during Excecution {{ $execution.id }}."
},
"typeVersion": 1
}
],
"active": false,
"pinData": {},
"settings": {
"callerPolicy": "workflowsFromSameOwner",
"errorWorkflow": "YEvXt4fjXiqx3zZt",
"executionOrder": "v1",
"executionTimeout": 180,
"timeSavedPerExecution": 1
},
"versionId": "8ce7def3-17ae-4650-a873-6b72993f9483",
"connections": {
"ffc767d3-b651-4f9f-b0ae-ea1b0b80eccf": {
"main": [
[
{
"node": "e6feed01-0eb5-4ff0-b11c-209f871770ab",
"type": "main",
"index": 0
}
]
]
},
"e6feed01-0eb5-4ff0-b11c-209f871770ab": {
"main": [
[
{
"node": "48a3601f-f1b1-4702-aee0-e3170448398c",
"type": "main",
"index": 0
}
],
[
{
"node": "f24d8323-21dd-4a46-8b46-7963e3117ba6",
"type": "main",
"index": 0
}
],
[
{
"node": "79fdfe12-88d2-4ead-b309-80ba869e7673",
"type": "main",
"index": 0
}
],
[
{
"node": "5dcddab3-babe-4694-837d-b0831b63c9bd",
"type": "main",
"index": 0
}
]
]
},
"c6011620-2dfb-4e0e-8770-18589b58dd0d": {
"main": [
[
{
"node": "ffc767d3-b651-4f9f-b0ae-ea1b0b80eccf",
"type": "main",
"index": 0
}
]
]
}
}
}¿Cómo usar este flujo de trabajo?
Copie el código de configuración JSON de arriba, cree un nuevo flujo de trabajo en su instancia de n8n y seleccione "Importar desde JSON", pegue la configuración y luego modifique la configuración de credenciales según sea necesario.
¿En qué escenarios es adecuado este flujo de trabajo?
Intermedio
¿Es de pago?
Este flujo de trabajo es completamente gratuito, puede importarlo y usarlo directamente. Sin embargo, tenga en cuenta que los servicios de terceros utilizados en el flujo de trabajo (como la API de OpenAI) pueden requerir un pago por su cuenta.
Flujos de trabajo relacionados recomendados
Kai S. Huxmann
@kaihuxmannCompartir este flujo de trabajo