I'm using the Salesforce SOAP API via the PHP library and trying to figure out the proper format to submit an Address compound field type. I've tried submitting as an associative array:

[ShippingAddress] => Array( [Accuracy] => [City] => city [Country] => [CountryCode] => [Latitude] => [Longitude] => [PostalCode] => zip [State] => [StateCode] => [Street] => street )

which gives me an array to string error from SforcePartnerClient, as well as a flat array:

[ShippingAccuracy] => [ShippingCity] => city [ShippingCountry] => [ShippingCountryCode] => [ShippingLatitude] => [ShippingLongitude] => [ShippingPostalCode] => zip [ShippingState] => [ShippingStateCode] => [ShippingStreet] => street

Which throws an undefined field error on ShippingAccuracy.

What is the proper field format to submit the Address compound field type?

  • Are you populating the latitude and longitude fields as well? I believe you can only update Accuracy if the address is geocoded.
    – Mike Chale
    Commented Oct 15, 2015 at 19:05

1 Answer 1


From the SOAP API documentation on Compound Fields:

Compound fields are accessible as a single, structured field, or as individual component fields. The values contained within the compound field and the values in individual fields both map to the same underlying data stored in Salesforce; they always have identical values. Code that references individual component fields is unaffected by the new compound fields.

Compound fields are read-only. Changes are performed by writing to the individual component fields. This maintains a single, consistent method for performing updates, and avoids the possibility of conflicts. For example, if both the BillingAddress compound field and BillingCity individual component field were updated in the same API call, it would be unclear which value should be saved.

You will need to use the individual fields to make changes.

  • Thanks Daniel, but that doesn't really answer the question. If I'm supposed to write to the individual component fields, why does it fail with ShippingAccuracy as an invalid field?
    – dbcn
    Commented Oct 16, 2015 at 13:37
  • Ok, I removed ShippingAccuracy and the compound field was properly accepted by the API. So to answer the question, you need the flat array, but be wary of API changes to the child fields.
    – dbcn
    Commented Oct 16, 2015 at 14:40

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .