restsalesforcesoql

What are the API names for Address' compound fields that are not Mailing/Billing/Etc.? Salesforce


So I currently am working with SOQL (PATCH API Call) to update an Address field on a contact record. This Address field is called Address 2 (API Name: Address_2__c) but I cant seem to be able to pass the correct api name for the compound fields on the json body.

{

    "Address_2__cCountry" : "<Country>",

    "Address_2__cStreet" : "<Street>",

    "Address_2__cCity" : "<City>",

    "Address_2__cState" : "<State>"

}

I have tried Address_2__c.City / Address_2__c.City__c / Address_2__c.City__s / Address_2__c__City__c / Address_2__c__City__s and none have worked.


Solution

  • So, it seems that I was close to the answer. Here is the correct API Name: "AddressCustomName__CompoundFieldName__s" ("Address_2__City__s", for example). This doesn't show at all on salesforce's documentation as far as I know.

    Note: Jeremy's approach doesn't yield the correct API name as the payload's (Address_2.City), for some reason, are different from the actual ones.

    I hope this helps someone in the future.