0

enter image description here

I want to add email address to create a contact of type Household , how I can achieve it as while checking in API explorer I don't see it.

$result = civicrm_api3('Contact', 'create', [
  'contact_type' => "Household",
  'household_name' => "Test",
  'email' => 'abc@gmail.com
]];

I was trying to convert civicrm API v2 to civicrm API v3. In civicrm API v2, I saw this, so I thought we may have some way to add email directly in API v3 (also not sure if api v2 below is correct)

$householdParams = array(
                    'household_name' => $familyName,
                    'contact_type'   => 'Household',
                    'email'          => $form_state['storage']['contactInfoValues']['emailAddress']
                    );
$householdContact =&civicrm_contact_add($householdParams);
5

You will have to use the Email API with the contact_id of the just created contact. You can do this in a chained API call if you want to.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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