I would like to take a set of custom fields in CiviCRM which are attached to one Contact type (Individual), and move them to be attached to another Contact type (Organization). The fields are similar, but they are not all identical.
What is the best way of handling this? Export the custom fields and clean up the CSV before importing into the newly created custom fields?
The most efficient way would be straight through SQL:
INSERT INTO civicrm_value_org_stuff
SELECT null as id, c.current_employer_id as entity_id, i.first_field as first_org_field, i.second_field as second_org_field ...
FROM civicrm_value_ind_stuff i
LEFT JOIN civicrm_contact c ON c.id = i.entity_id
LEFT JOIN civicrm_value_org_stuff o ON c.current_employer_id = o.entity_id
WHERE o.id is null AND c.current_employer_id is not null
You'll have to take care of situations where there's already information in the destination table, but otherwise this should work fine. The table names are obviously made up, but they'll begin with "civicrm_value..." and the field names should be clear from that.