20

All contacts have a type of either "individual", "household", or "organization".

How can I change this type for an existing contact?

3 Answers 3

12

The Contact Editor extension allows you to change contact types safely. It checks for potential data loss, which isn't possible with the API method or the Merge method.

Change contact type

16

Say you want to convert from an individual to a household. One very hack-ish way is as follows:

  1. Create a new household with the desired household name.

  2. Note the "contact id" values for the individual (INDIVIDUALID) and for the newly created household (HOUSEHOLDID). (You can find this "contact id" value at the bottom of the screen when viewing the contact where it says something like "CiviCRM ID: 2345". Also this id value is in the URL of the page where you view the contact.)

  3. Manually navigate to the following URL where you will merge the two contacts. In this URL you will have to replace "HOUSEHOLDID" with the id value for your newly created household and replace "INDIVIDUALID" with the id for the individual you want to "convert" to a household.

    http://example.com/civicrm/contact/merge?reset=1&cid=HOUSEHOLDID&oid=INDIVIDUALID&action=update

  4. Check all boxes, except make sure "contact type" and any "name" fields are un-checked

  5. Merge the individual into the household.

4
  • 5
    That's a clever hack, and a helpful trick to have in your pocket if you need to merge contacts that aren't obviously dupes. Another approach would be direct edit via SQL (change value in civicrm_contact.contact_type and remove/add values in first_name, last_name, household_name, etc. columns). Commented Mar 24, 2015 at 17:53
  • 1
    @DaveGreenberg I think this merits being a 2nd answer to the question.
    – Coleman
    Commented Apr 10, 2015 at 15:04
  • The direct SQL update approach has risks - notably if the contact has contact-type specific custom data attached. Hence, actually liking Sean's suggestions as the primary route. Commented Apr 13, 2015 at 17:41
  • 1
    One thing to remember is that cid = "contact id for the record you want to keep" and oid = "contact Id for the record you want to merge then delete".
    – JoAnne
    Commented Jun 3, 2015 at 11:24
7

This is a not so trivial issue, as you might have a lot of related data around that contact that were correct with an individual but might not be compatible with a household any more. For instance is the individual had custom data that are only valid for an individual, or a relationship "child of", or attended to an event... transforming that individual into an household might lead to weird results (eg. having "smith family" being the child of John or being a speaker with gluten intolerance at your latest gala dinner.

Now that you've been warned and that you are sure you are not going to create these monsters into your database, the trick I use is to use the api:

  • go to the api explorer (example.org/civicrm/api/explorer on drupal)
  • choose contact create as the entity+action
  • add the parameter contact type=Household
  • add the parameter internal id= the contact id of your contact
  • add the parameter household name= "smith family"

so the drush command generated looks like

drush cvapi Contact.create sequential=1 contact_type="Household" id=42 household_name="Bob's family"  

and press execute and confirm you're ok to write to the database

And voila, it's an household. they are a few other parameters you might want to alter (addressee, the greetings), but it should get you covered, without having to attack directly the database

Api explorer is your friend, use it with moderation ;)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.