Skip to content
Data & Databases

Explicit Link Keys Before Merge with Post-Merge Reference Recovery Audit

6 nodes 50 5 Manual trigger
Download

Loading workflow…

Workflow Description

A fully local template that fixes broken item references after a Merge node. A manual trigger feeds two Code branches that stamp every item with an explicit composite link key built from branch id, source index and a normalized fingerprint of distinguishing fields. Branches are appended by Merge, then a final Code node validates key uniqueness, builds a copy-ready reference expression per item, and emits one report item listing per-branch counts, merged count, duplicate keys, missing indexes and invalid rows. A Set node adds the pattern name while keeping all fields. No credentials, no external calls.

How it works

  1. 1.Manual Trigger starts both branches.
  2. 2.Branch A Code emits three rows and adds linkKey = A#index#fingerprint(orderId,amount).
  3. 3.Branch B Code emits rows at indexes 0, 2, 3 (index 1 intentionally missing, one invalid row) with linkKey = B#index#fingerprint(orderId,status).
  4. 4.Merge in append mode joins branch A to input 1 and branch B to input 2.
  5. 5.Final Code counts items per branch, detects duplicate keys, computes index-level gaps, flags invalid rows, outputs enriched items plus one verification report item.
  6. 6.Set with includeOtherFields:true appends workflowPattern to every item.

Use cases

  • Guarantee per-item reference recovery after merging branches
  • Detect a lost item by its index instead of only a count delta
  • Produce stable reference expressions that survive Merge
  • Audit link-key uniqueness before building downstream logic

Requirements

  • n8n 2.45.7 or a compatible version
  • No credentials and no network access
  • Replace both rows arrays with real items of the same schema
  • Update keyFields per branch with your real distinguishing fields

Setup and testing in n8n

  1. Import the workflow JSON and open it.
  2. Click Execute Workflow and inspect the Stamp Pattern Name output.
  3. Verify the six linked items each carry a unique linkKey with linkKeyUnique=true.
  4. Verify the report item shows indexGaps for branch B at index 1 and invalidItems for the empty orderId row.
  5. Edge cases: duplicate a row in branch A so status becomes failed_duplicate_keys; empty both rows arrays to get the empty_input report.

Service Value

Ready-made workflow template for automation delivery and service execution.

Apps Used

Manual Trigger Code Merge Set

Details

Trigger Manual trigger
Nodes 6
Apps 4
Views 50
Downloads 5

How to Use

  1. 1.Click "Download Template"
  2. 2.Open your n8n dashboard
  3. 3.Go to Workflows > Import from File
  4. 4.Select downloaded file and configure credentials

Nodes Used (6)

Manual Trigger

Manual Trigger

#1

Branch A Source And Link Key

Code

#2

Branch B Source And Link Key

Code

#3

Merge Branches

Merge

#4

Verify And Build Reference

Code

#5

Stamp Pattern Name

Set

#6

Note Sources

Sticky Note

#7

Note Merge

Sticky Note

#8

Note Verification

Sticky Note

#9
Stay in the loop

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

Be first to discover what is new

Your name, your email, and one confirmation.

Email confirmation · Unsubscribe anytime