Synthesize Missing Client Contacts for Matters

Synthesize Missing Client Contacts for Matters

This script below will create dummy contacts where the Matter is assigned to a contact that no longer exists.

  1. --Some of the Matters are linked to contacts that no longer exist.
  2. --This will create dummy contacts from the missing links.
  3. INSERT INTO __M_Contacts (
  4. Id,
  5. Final_Kind,
  6. Final_FullName
  7. ) SELECT DISTINCT Final_ClientContact_Id,

  8. 'Company',
  9. CONCAT('Missing Contact --- ', Final_ClientContact_Id) FROM __M_Matters WHERE 1=1 AND Final_ClientContact_Id != '' --Remove this to create a contact for No Contacts AND Final_ClientContact_Id NOT IN (SELECT Id from __M_Contacts)