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 template as you see fit.
- --In our Source system, Matter's don't have an Opened date
- --But our client created a custom field named 'Opened'.
- --We are going to copy that value into the Matter's Final_Date_Opened
- UPDATE
- __M_Matters
- SET
- Final_Date_Opened = V2.Final_Value
- FROM
- __M_CustomField_Definitions V1,
- __M_CustomField_Values V2,
- __M_Matters V3
- WHERE 1=1
- AND V1.Final_Subject = 'Opened'
- AND V1.Final_Parent_Type = '__M_Matters'
- AND V2.Final_CustomFieldDefinition_Id = V1.Id
- AND V2.Final_Parent_Type = V1.Final_Parent_Type
- AND V3.Id = V2.Final_Parent_Id