How to set contact primary address

Hi all.

I create new Contact, pass to curl following data:

$url = $baseURL . "/Contacts";
$record = array(
"date_entered" => "$dateEntered",
"assigned_user_id" => "$uid",
"created_by" => "$uid",
"team_id" => "1",
"salutation" => "$title",
"first_name" => "$firstName",
"last_name" => "$lastName",
"phone_work" => "$tel",
"phone_fax" => "$fax",
"email" => array(
array(
"email_address" => "$email",
"primary_address" => true
)
),
"primary_address_street" => "$address",
"primary_address_city" => "$city",
"primary_address_postalcode" => "$zipcode",
"primary_address_country" => "$country",
);

Record is created, all the fields, including email (in email_addresses), are populated, EXCEPT the primary address fields - they are all empty.

What do I need to do to set those fields preferably during creating a Contact if possible.

Thanks for your help,

Azriel.

Parents
  • I would not quote the php variables as you did e.g. here:

        "primary_address_street"     => "$address",
    "primary_address_city" => "$city",
    "primary_address_postalcode" => "$zipcode",
    "primary_address_country" => "$country",

    php interprets the content between the quotes, so if there is some "strange" content it could break.

    Just use

        "primary_address_street"     => $address,
    "primary_address_city" => $city,
    "primary_address_postalcode" => $zipcode,
    "primary_address_country" => $country,

    Harald Kuske
    Principal Solution Architect – Professional Services, EMEA
    hkuske@sugarcrm.com
    SugarCRM Deutschland GmbH

Reply
  • I would not quote the php variables as you did e.g. here:

        "primary_address_street"     => "$address",
    "primary_address_city" => "$city",
    "primary_address_postalcode" => "$zipcode",
    "primary_address_country" => "$country",

    php interprets the content between the quotes, so if there is some "strange" content it could break.

    Just use

        "primary_address_street"     => $address,
    "primary_address_city" => $city,
    "primary_address_postalcode" => $zipcode,
    "primary_address_country" => $country,

    Harald Kuske
    Principal Solution Architect – Professional Services, EMEA
    hkuske@sugarcrm.com
    SugarCRM Deutschland GmbH

Children
No Data