1

Is there a way to tell CiviCRM not to set newly-imported addresses as primary addresses?

For example, let's say I have a database where everyone has nicely-curated "Home" addresses. I make a new location type "Voter" to import voter file addresses. The import process will make "Voter" the primary, but I want "Home" to remain primary.

The only way I know of is to backup the civicrm_address table and revert them using SQL, but it would be nice to skip that step.

1

I don't know if there's a way to handle this through the User Interface. I added a function into a custom extension, which seems to solve the issue:

function myext_civicrm_pre($op, $objectName, $objectId, &$params) {
  if ($objectName == 'Address' && ($op == 'create' || $op == 'edit')) {
    if ($_SERVER['REQUEST_URI'] == '/civicrm/import/contact') {
      unset($params['is_primary']);
    }
  }
}

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.