AI Help
How do I merge n8n branches by a record ID instead of item position?
Use Merge's matching-field option with a stable record key and define how unmatched and duplicate keys should behave.
Steps to follow
- Normalize the chosen ID consistently in both branches while retaining original values for inspection.
- Configure matching fields in the Merge node using the options available in your node version.
- Test reversed input order, missing IDs and duplicate IDs. Reconcile output counts before downstream updates.
Example in practice
Illustrative example. Branches returning contacts in different orders still join contact-17 to contact-17 through its ID.
Related AI help
- How do I find where n8n lost the link to the original input item?
- How do I pass an error from an n8n sub-workflow back to its parent?