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) »
  • How to register a phone on civicrm_contact_add ?
Pages: [1]

Author Topic: How to register a phone on civicrm_contact_add ?  (Read 1816 times)

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
How to register a phone on civicrm_contact_add ?
September 28, 2009, 06:00:32 am
Hi,

What is the proper syntax to register a contact with phone/fax that isn't on the default location ?

Code: [Select]
    $params['location'][2]=
                          array( 'location_type_id' => 6,
                                                'is_primary' => 0,
                                                'address' => $addressLine,
                                                'phone' => array (
                                                        1 => array ('is_primary'=>1,'phone_type' => 1,'phone' => $phone)
                                                        ),
                                                'email' => array( 1 => array('is_primary' => 1,'email' =>$params['email']))
                                     );


What is the proper syntax for the phone ? Works ok for the rest, but couldn't get the phone in.

X+



-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Kiran Jagtap

  • Ask me questions
  • ****
  • Posts: 533
  • Karma: 51
Re: How to register a phone on civicrm_contact_add ?
September 29, 2009, 08:34:58 am
r u checking w/ civicrm v3.0 ?

might want to take a look for params formats from civicrm_location_add : http://wiki.civicrm.org/confluence/display/CRMUPCOMING/Location+APIs.

hope this help

kiran
You Are Designed To Choose... Defined By Choice.

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: How to register a phone on civicrm_contact_add ?
September 29, 2009, 09:22:07 am
Do you have to call two apis ( civicrm_contact_add and then civicrm_location_add ?)
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Kurund Jalmi

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4169
  • Karma: 128
    • CiviCRM
  • CiviCRM version: 4.x, future
  • CMS version: Drupal 7, Joomla 3.x
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: How to register a phone on civicrm_contact_add ?
September 29, 2009, 09:36:40 am
Quote
Do you have to call two apis ( civicrm_contact_add and then civicrm_location_add ?)

You you have correct params you can only use civicrm_contact add api. For eg:
Code: [Select]
$params = array( 'first_name' => 'Hello',
                          'last_name'  => 'Hi',
                          'phone' => array( array( 'phone' => '11111', 'location_type' => 'Home'))
);

HTh

Kurund
Found this reply helpful? Support CiviCRM

xavier

  • Forum Godess / God
  • I’m (like) Lobo ;)
  • *****
  • Posts: 4453
  • Karma: 161
    • Tech To The People
  • CiviCRM version: yes probably
  • CMS version: drupal
Re: How to register a phone on civicrm_contact_add ?
October 04, 2009, 02:23:17 pm
Great, taking shape ;)

What about the fax ?

Is there a way to import the fax directly too ?

X+
-Hackathon and data journalism about the European parliament 24-26 jan. Watch out the result

Donald Lobo

  • Administrator
  • I’m (like) Lobo ;)
  • *****
  • Posts: 15963
  • Karma: 470
    • CiviCRM site
  • CiviCRM version: 4.2+
  • CMS version: Drupal 7, Joomla 2.5+
  • MySQL version: 5.5.x
  • PHP version: 5.4.x
Re: How to register a phone on civicrm_contact_add ?
October 04, 2009, 05:45:15 pm

u can add a phone_type_id to the array values (the phone_type_id for fax is 5)

lobo


A new CiviCRM Q&A resource needs YOUR help to get started. Visit our StackExchange proposed site, sign up and vote on 5 questions

Pages: [1]
  • CiviCRM Community Forums (archive) »
  • Old sections (read-only, deprecated) »
  • Developer Discussion »
  • APIs and Hooks (Moderator: Donald Lobo) »
  • How to register a phone on civicrm_contact_add ?

This forum was archived on 2017-11-26.