Convert a Custom Field into a Practice Area
- --The system we are coming from does not have practice areas
- --however, the client has created a picklist custom field that mimics this.
- --We are going to convert this custom field into a practice area.
- --First, populate the practice areas table with our new values.
- INSERT INTO __M_Matters_PracticeAreas(
- Id,
- Final_Subject
- )
- SELECT
- V2.Id,
- V1.Final_Subject
- FROM
- __M_CustomField_Definitions V1,
- __M_CustomField_Definitions_Options V2
- WHERE 1=1
- --Change this to be the name of the custom field we're converting into a practice area
- AND V1.Final_Subject = 'Case Type'
- AND V1.Final_Parent_Type = '__M_Matters'
- AND V1.Final_Kind = 'PickList'
- AND V2.Final_CustomFieldDefinition_Id = V1.Id
- --Now, update our matters to use these practice areas.
- UPDATE
- __M_Matters
- SET
- Final_PracticeArea_Id = V2.Id
- FROM
- __M_CustomField_Definitions V1,
- __M_CustomField_Definitions_Options V2,
- __M_CustomField_Values V3,
- __M_Matters V4
- WHERE 1=1
- --Change this to be the name of the custom field we're converting into a practice area
- AND V1.Final_Subject = 'Case Type'
- AND V1.Final_Parent_Type = '__M_Matters'
- AND V1.Final_Kind = 'PickList'
- AND V2.Final_CustomFieldDefinition_Id = V1.Id
- AND V2.Id = V3.Final_Value
- AND V3.Final_CustomFieldDefinition_Id = V1.Id
- AND V3.Final_Parent_Type = V1.Final_Parent_Type
- AND V3.Final_Parent_Id = V4.Id
Related Articles
Convert Any Field into a Picklist
The following script lets you convert any field into a picklist. --This script will convert any field (usually text fields) into Picklists --and generate Picklist Options from the values. GO DECLARE @Ids Table(Id NVARCHAR(MAX)) INSERT INTO @Ids ...
Copy a Custom Field into a Core Field
Some systems don't have certain core fields and clients often create a custom field that they use instead. The following script will let you copy values from a custom field named 'Opened' into __M_Matters.Final_Date_Opened . You can adjust this ...
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 ...
Copy Calendar Entry Dates into Custom Field Values
Some systems let you create custom fields that reference a Calendar Entry. When moving custom fields into a system that does not support this, an easy workaround would be to turn these custom fields into DateTime custom fields by copying in the start ...
Create an "Employer" Contact from a Custom Field.
In some systems, contacts do not have an Employer relation and only have a text field that represents the employer. This script will help when moving firms into platforms that allow an actual contact to be specified for the employer. --Create Company ...