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) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Shared address by API?
Pages: [1]

Author Topic: Shared address by API?  (Read 679 times)

robinhood

  • I post frequently
  • ***
  • Posts: 153
  • Karma: 6
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
  • MySQL version: 5.1.56
  • PHP version: 5.3.5
Shared address by API?
September 29, 2012, 08:43:06 pm
Is it still true that you can't create a shared address via the API in version 4.2.1?  If it does work, can you point me in the direction of an example to follow?

Thanks.

Eileen

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4195
  • Karma: 218
    • Fuzion
Re: Shared address by API?
October 01, 2012, 01:14:29 am
You need to know the id of the address you want to share - then you can do it - ie.

civicrm_api('address','create',array('master_id' = x, other details);

Note that CiviCRM duplicates address details so doing this creates the linkage which provides the front end management but doesn't fill the fields on the child address.
Make today the day you step up to support CiviCRM and all the amazing organisations that are using it to improve our world - http://civicrm.org/contribute

Coleman Watts

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 2346
  • Karma: 183
  • CiviCRM version: The Bleeding Edge
  • CMS version: Various
Re: Shared address by API?
October 01, 2012, 03:42:42 am
I don't think this has ever been true. Webform CiviCRM integration uses the api for this and it works fine - have a look at that code to see how it's done.
Basically, retrieve the master address and use it as params for address create. With those params, set 'master_id' to the value of 'id' and then unset 'id'. Set the value of 'contact_id' to the appropriate contact, and then save.
Try asking your question on the new CiviCRM help site.

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: Shared address by API?
October 01, 2012, 04:37:08 am
in general, any information about the API from 2010 is about version 2, we are using version 3 now that is a different beast.

Take any old info with a pinch of salt, probably not talking about the same thing as you use.
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

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: Shared address by API?
October 01, 2012, 06:53:43 am
I have actually updated the Developer Guide chapter on the API during the last sprint in Apeldoorn, have a look http://book.civicrm.org/developer/current/techniques/api/
Consultant/project manager at EEatWork and CiviCooP (http://www.civicoop.org/)

robinhood

  • I post frequently
  • ***
  • Posts: 153
  • Karma: 6
  • CiviCRM version: 4.5.5
  • CMS version: Drupal 7.34
  • MySQL version: 5.1.56
  • PHP version: 5.3.5
Re: Shared address by API?
October 01, 2012, 12:59:05 pm
This is very helpful, thanks to all.

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • Shared address by API?

This forum was archived on 2017-11-26.