← All ideas
0

CRM: Keep synced emails, enrollments and form history when merging contacts

LaunchedCRMFix

HubSpot merges keep activities, associations and most property values from both records (https://knowledge.hubspot.com/records/merge-records). Our mergeContacts in lib/crm.ts moves contact_id on crm_emails but never repoints crm_email_contacts, and then deletes the dropped contact, so its rows cascade away (lib/schema/migrations.ts:995) and those emails disappear from the kept contact's timeline, which reads through crm_email_contacts (lib/crm-email.ts:777) and also feeds lead scoring. Sequence enrollments cascade-delete, form submissions lose their contact (ON DELETE SET NULL), property history stays orphaned, and empty fields on the kept contact are not filled from the dropped one. A small team merging a duplicate silently loses its email history. Fix: repoint crm_email_contacts, crm_sequence_enrollments, crm_form_submissions and crm_property_events inside the same transaction, fill blank fields from the dropped record, and add a regression test next to tests/unit/crm.test.ts 'merge de contactos'. Priority: high. Effort: S. Compared with HubSpot.

Comments 0

No comments yet.