Merge Branch Completion Receipt Generator with Empty Branch Detection
Loading workflow…
Workflow Description
A self-contained template that splits JSON records with an IF node, tags each item with its branch name in two Code nodes that return an empty array for empty branches, then combines both via an append-mode Merge that never stalls. A final Code node emits a single receipt documenting per-branch counts and the empty branch list, and an IF routes receipts with an empty branch to a review NoOp while complete receipts flow on the other path. Fully local, no external calls.
How it works
- 1.Run the Manual Trigger; the sample Code node emits fictional records (normal and invalid)
- 2.The IF routes records: status='ok' to the true branch, others to the false branch
- 3.Each branch Code node stamps items with source_branch and handles empty input by returning []
- 4.The append-mode Merge combines both branch outputs
- 5.A final Code node builds one receipt with inputCounts, emptyBranches, emptyBranchesCount and totalItemsMerged
- 6.The final IF checks emptyBranchesCount: zero routes to the complete path, otherwise to the review NoOp
Use cases
- Diagnosing Merge nodes stalling after IF when one branch is always empty
- Documenting per-branch item counts for every execution
- Isolating invalid records into a side branch with a receipt showing how many arrived
Requirements
- An n8n version supporting manualTrigger, code, if, merge, noOp and stickyNote
- No credentials or external connections required
Setup and testing in n8n
- Import the JSON into n8n and execute the workflow
- Verify the default receipt (SCENARIO='both') shows branch_true=2, branch_false=1, empty emptyBranches on the complete path
- Set SCENARIO='emptyFalse' and re-run: a receipt with emptyBranches=['branch_false'] routes to the review path without stalling
- For real data, replace the sample node with your source; items must carry a string status field
Service Value
Ready-made workflow template for automation delivery and service execution.
Apps Used
Details
How to Use
- 1.Click "Download Template"
- 2.Open your n8n dashboard
- 3.Go to Workflows > Import from File
- 4.Select downloaded file and configure credentials
Nodes Used (10)
Manual Trigger
Manual Trigger
Sample Data (Fictional Test Records)
Code
Branch Split (status = ok)
If
Tag True Branch
Code
Tag False Branch
Code
Merge Branches (Append)
Merge
Build Completion Receipt
Code
Empty Branch Check
If
Complete Flow (No Empty Branch)
No Op
Empty Branch Detected - Review
No Op
Stage 1 - Input & Split
Sticky Note
Stage 2 - Tagging & Merge
Sticky Note
Stage 3 - Receipt & Routing
Sticky Note
Fresh workflows, straight to your inbox
Get newly published DROPIDEA workflows, a clear overview of what they do, and a link to explore them.
- New workflows
- Clear overviews
- Setup guides