Create a "Legacy Matter Number" Custom Field

Create a "Legacy Matter Number" Custom Field

Some firms rely heavily on Matter Numbers to search for a specific matter.  Sometimes when they migrate to a new system it can't replicate the automatic numbering system from their old system so they want to renumber all their matters to a new scheme that the new system CAN support.  However, they may also want to preserve the old matter numbers so they can search for matters using those numbers.

The script below will create a custom field named 'Legacy Matter Number' and populate it with the matter numbers from their source system.

  1. INSERT INTO __M_CustomField_Definitions (
  2. Id,
  3. Final_Kind,
  4. Final_Subject,
  5. Final_Parent_Type
  6. )
  7. VALUES (
  8. 'Legacy Matter Number',
  9. 'TextLine',
  10. 'Legacy Matter Number',
  11. '__M_Matters'
  12. )

  13. INSERT INTO __M_CustomField_Values (
  14. Id,
  15. Final_Parent_Id,
  16. Final_Parent_Type,
  17. Final_CustomFieldDefinition_Id,
  18. Final_Value
  19. )
  20. SELECT
  21. CONCAT('Legacy Matter Number --- ', Id),
  22. Id,
  23. '__M_Matters',
  24. 'Legacy Matter Number',
  25. Final_ReferenceCode
  26. FROM
  27. __M_Matters
  28. WHERE 1=1
  29. AND LEN( Final_ReferenceCode ) > 0