1

I am trying to insert a new Person Account using the Force.com Toolkit for .NET (which is working brilliantly for everything but this so far). The insertion works except for the Mailing Address field (PersonMailingAddress), which generates the following exception:

{"Cannot deserialize instance of PersonMailingAddress from VALUE_STRING value Royal Oak at [line:1, column:113]"}

PersonMailingAddress is a property on my model that I'm inserting. "Royal Oak" is the value of the city field. I've tried it with various different values, with/without spaces, all generate this same error. Since this is a compound field, I created a separate class for it, called Address:

public class Address
{
    [JsonProperty(PropertyName = "City")]
    public string MailingCity { get; set; }

    [JsonProperty(PropertyName = "Country")]
    public string MailingCountry { get; set; }

    [JsonProperty(PropertyName = "PostalCode")]
    public string MailingPostalCode { get; set; }

    [JsonProperty(PropertyName = "State")]
    public string MailingState { get; set; }

    [JsonProperty(PropertyName = "Street")]
    public string MailingStreet { get; set; }
}

The values are set then pushed up using CreateAsync and that's when this error returns. If I leave the PersonMailingAddress field off my model it inserts just fine. (As a side note, this Address object works when inserting a Contact, it seems to just be the Account/Person Account that it has trouble with.)

Any thoughts as to how I should get this to insert properly?

2

There is no MailingAddress on a Person Account (Account), the addresses are PersonMailingStreet, PersonMailingCity, etc

On a person Account only the BillingStreet, BillingCity, etc are available

Just in case

Compound fields are read-only. To update field values, modify the individual field components.

You need to update the individual components:

  • PersonMailingStreet
  • PersonMailingCity

etc

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/compound_fields_limitations.htm

  • When I go to Setup > Customize > Accounts > Fields, under Account Standard Fields is a field labeled "Mailing Address" with the "Field Name" of "PersonMailingAddress" with a type of "Address" ... so there is a field with that name. That field is on my view of the person account also. That is the field I'm trying to update; should that just be PersonMailingStreet, etc.? – Nathan Loding Aug 27 '15 at 12:42
  • @NathanLoding - Yes, but it is a compound field. See above – Eric Aug 27 '15 at 12:52
  • Sorry, too early in the AM, totally read your comment as "There is no PersonMailingAddress" ... wow ... your answer makes total sense, I just didn't pick on this from the docs. Thanks! I'll mark it as the answer after I've confirmed it's working later today. – Nathan Loding Aug 27 '15 at 12:55

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.