All problems

Customer Merge Leaves Contacts Pointing to the Deleted Customer

Level 3 · node · Data · Missing reference migration during entity merge

Scenario

When duplicate CRM customers are merged, orders and contacts owned by the source customer must move to the target before the source is deleted. Orders move correctly, but contact ownerCustomerId values remain unchanged and point to the deleted customer. Customer, order, and contact repositories are separated.

Requirements

- Move source customer orders to the target customer - Move source customer contacts to the target customer - Delete the source only after references are migrated - Preserve existing orders and contacts already owned by the target - No order or contact may reference the source customer after merge

Acceptance criteria

  • Source orders reference the target customer
  • Source contacts reference the target customer
  • Source customer is deleted
  • Existing target-related data is preserved
  • No source customer references remain after merge