CiviCRM Community Forums (archive)

*

News:

Have a question about CiviCRM?
Get it answered quickly at the new
CiviCRM Stack Exchange Q+A site

This forum was archived on 25 November 2017. Learn more.
How to get involved.
What to do if you think you've found a bug.



  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • Solution Found: Importing Shared Addresses
Pages: [1]

Author Topic: Solution Found: Importing Shared Addresses  (Read 1326 times)

TeakMcGlukes

  • I’m new here
  • *
  • Posts: 27
  • Karma: 2
  • CiviCRM version: 4.3.7
  • CMS version: Joomla 3.1.5
  • MySQL version: 5.1.52
  • PHP version: 5
Solution Found: Importing Shared Addresses
October 20, 2013, 10:48:26 am
I just wanted to write up something that I figured out how to do that I wasn't able to find elsewhere on the site.  It deals with importing shared addresses.  For search engine purposes, it could also be called:

  • "Use another contact's address"
  • "Address belongs to"
  • "Master Address Belongs To"

This feature is extremely handy for multiple contacts that share a single address.  In the contact file, you can click "Use another contact's address" and then pick a contact.  Now, the contact you are on uses the other contact's address.  This saves a lot on data entry, plus down the road when that business moves or the contact information changes, it'll update all the related accounts.

The problem was that I couldn't figure out a good way to do that en masse.  But tinkering brought me to it.  I am on version 4.3.7.

  • What I did, and I don't know how you'd get around this, is that I already had both the parent and children contacts in the system (through an import but could be done any way).
  • Look up the Internal Contact ID for the child contacts.  This in the contact's file, or can be looked up in phpMyAdmin.
  • You'll need to look at the SQL database for this one, I use phpMyAdmin.  In the civicrm_address table, you'll need to look up the 'id' field for the parent address.  This is the key or index for the table, do not use the contact_id which is readily available in the system everywhere (pick up on the annoyance?).  This is the only real "catch" that makes the process slow down.
  • Create your import file with just the child Internal Contact ID in one column and the civicrm_address.id in the other.
  • Go to import contacts, use the "individual" and "update" options.
  • Map the Internal Contact ID of the children to "Internal Contact ID*"
  • Map the civicrm_address.id column to "Master Address Belongs To"
.
  • Finish the import.
  • Go to the parent contact ID and "edit" the address you just mapped to everyone.  It should give you a warning, "Editing Master Address: This address is shared with 21 contact record(s). Modifying this address will automatically update the shared address for these contacts."
  • You don't actually have to make any modifications, just save it.
  • Now go back to the associated children and the address should be updated.

It sounds like a hassle, it is somewhat.  But, I have almost 6,000 contacts from about 200 companies, so associating those addresses is crucial and makes for clean data and uniformity.

Let me know if you need any help.

Teak
« Last Edit: October 20, 2013, 11:05:20 am by TeakMcGlukes »

Erik Hommel

  • Forum Godess / God
  • I live on this forum
  • *****
  • Posts: 1773
  • Karma: 59
    • EE-atWork
  • CiviCRM version: all sorts
  • CMS version: Drupal
  • MySQL version: Ubuntu's latest LTS version
  • PHP version: Ubuntu's latest LTS version
Re: Solution Found: Importing Shared Addresses
October 20, 2013, 11:39:21 pm
Thanks for sharing!
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

linkx

  • I post occasionally
  • **
  • Posts: 86
  • Karma: 7
Re: Solution Found: Importing Shared Addresses
October 03, 2014, 09:29:22 am
Teak,

Thank you for this! We recently discovered that Shared Address works wonders for our use-case, so needed to update 2k contacts to share an address with their Current Employer. Using your tip, here is the query that I used:

Code: [Select]
SELECT civicrm_contact.id, civicrm_address.id FROM civicrm_contact INNER JOIN civicrm_address ON civicrm_contact.employer_id=civicrm_address.contact_id
Then dumped the results into a CSV and imported according to your instructions. Worked great!


Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Support »
  • Using CiviCRM »
  • Using Import (Moderator: Yashodha Chaku) »
  • Solution Found: Importing Shared Addresses

This forum was archived on 2017-11-26.