Salesforce getting MailingAddress from Contacts

salesforce

Solution

The fields are called `MailingStreet, MailingCity, MailingState, MailingPostalCode, MailingCountry`

I'd recommend you find a schema explorer tool and get comfortable with it (e.g. SoqlX, apexExplorer, Schema Surfer there are many), they'll help you get upto speed on what all the API names are for the schema in your organization.

Problem

I'm writing an Apex program to go through a list of Contacts and lookup the addresses in another database. Contacts have a built-in MailingAddress field, but accessing the data member gives me a compilation error: Error: Compile Error: Invalid field MailingAddress for SObject Contact at line 65 column 55 What is the correct way to get the Mailing Address?

Original source