{"product_id":"n8n-lead-intake-validation-with-code-switch-decision-workflow","title":"n8n Lead Intake Validation with Code \u0026 Switch Decision Workflow","description":"\u003ch3\u003eValidate and triage incoming leads in n8n—before they hit your CRM\u003c\/h3\u003e\n\u003cp\u003eThis n8n workflow demonstrates how to \u003cstrong\u003ediagnose malformed or incomplete lead payloads\u003c\/strong\u003e using a \u003cstrong\u003eCode + Switch decision workflow\u003c\/strong\u003e. It runs nine fictional edge-case examples and produces \u003cstrong\u003eexplainable review decisions\u003c\/strong\u003e so you can see exactly why each lead is accepted, held, or flagged.\u003c\/p\u003e\n\n\u003ch3\u003eWhat this workflow does\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eManual execution:\u003c\/strong\u003e The workflow runs when you \u003cem\u003emanually execute\u003c\/em\u003e it (Manual Trigger).\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eGenerates 9 synthetic lead examples:\u003c\/strong\u003e It creates fictional leads covering common issues such as \u003cstrong\u003emissing contact details\u003c\/strong\u003e, \u003cstrong\u003einvalid email\u003c\/strong\u003e, \u003cstrong\u003eduplicate IDs\u003c\/strong\u003e, \u003cstrong\u003emalformed fields\u003c\/strong\u003e, and \u003cstrong\u003ebad UTM values\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003ePreflight validation in JavaScript:\u003c\/strong\u003e A Code step \u003cstrong\u003enormalizes text fields\u003c\/strong\u003e and validates key fields like \u003cstrong\u003eevent IDs\u003c\/strong\u003e, \u003cstrong\u003eemails\u003c\/strong\u003e, and \u003cstrong\u003ephone numbers\u003c\/strong\u003e.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eDuplicate detection per run:\u003c\/strong\u003e It detects \u003cstrong\u003eduplicate event IDs\u003c\/strong\u003e or \u003cstrong\u003eemail addresses\u003c\/strong\u003e within the current run.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eAssigns status + reason codes:\u003c\/strong\u003e Each lead is labeled with a triage status, reason codes, and normalized output fields for clear review.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eRoutes via Switch:\u003c\/strong\u003e Items are routed into review\/hold paths using a \u003cstrong\u003eSwitch\u003c\/strong\u003e node, including a \u003cstrong\u003efallback route\u003c\/strong\u003e for unexpected statuses.\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eInspectable branch outcomes:\u003c\/strong\u003e Each routed item is labeled with a \u003cstrong\u003eroute decision\u003c\/strong\u003e so you can inspect the final outcome per lead in the corresponding branch.\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eUse cases\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003eSales Ops builders validating lead ingestion rules before CRM handoff\u003c\/li\u003e\n  \u003cli\u003en8n learners learning \u003cstrong\u003eCode\u003c\/strong\u003e + \u003cstrong\u003eSwitch\u003c\/strong\u003e patterns for data triage\u003c\/li\u003e\n  \u003cli\u003eSaaS operators testing preflight handling for incomplete form submissions and tracking data issues\u003c\/li\u003e\n\u003c\/ul\u003e\n\n\u003ch3\u003eTechnical details\u003c\/h3\u003e\n\u003cul\u003e\n  \u003cli\u003e\n\u003cstrong\u003eNodes used:\u003c\/strong\u003e Manual Trigger, Set, Code, Switch, Sticky Note\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eWorkflow behavior:\u003c\/strong\u003e Generates nine fictional test rows, evaluates them in \u003cem\u003eEvaluate Lead Preflight\u003c\/em\u003e, then routes them through Decision paths\u003c\/li\u003e\n  \u003cli\u003e\n\u003cstrong\u003eSetup approach:\u003c\/strong\u003e Import the workflow JSON into an isolated n8n instance, keep it inactive, then run the Manual Trigger to inspect the nine-row outcomes\u003c\/li\u003e\n\u003c\/ul\u003e","brand":"N8N Commerce","offers":[{"title":"Default Title","offer_id":46217927688371,"sku":"N8N-20806","price":32.99,"currency_code":"GBP","in_stock":true}],"thumbnail_url":"\/\/cdn.shopify.com\/s\/files\/1\/0749\/6279\/6723\/files\/r1fydl_9f4hg6aL8FeDu0_PKk6pLr9.png?v=1791883649","url":"https:\/\/buyflowscripts.com\/products\/n8n-lead-intake-validation-with-code-switch-decision-workflow","provider":"N8N Commerce","version":"1.0","type":"link"}