I run the following apex:

SObjectType contactType = Schema.getGlobalDescribe().get('Contact');

Map<String, Schema.SObjectField> allContactFields = contactType.getDescribe().fields.getMap();

for(Schema.SObjectField field: allContactFields.values()){
    System.debug('field: ' + field);

Here is the output I am getting:

16:07:55.14 (91806772)|USER_DEBUG|[6]|DEBUG|field: Id
16:07:55.14 (91866937)|USER_DEBUG|[6]|DEBUG|field: IsDeleted
16:07:55.14 (91910290)|USER_DEBUG|[6]|DEBUG|field: MasterRecordId
16:07:55.14 (91962227)|USER_DEBUG|[6]|DEBUG|field: AccountId
16:07:55.14 (91995161)|USER_DEBUG|[6]|DEBUG|field: LastName
16:07:55.14 (92023524)|USER_DEBUG|[6]|DEBUG|field: FirstName
16:07:55.14 (92049920)|USER_DEBUG|[6]|DEBUG|field: Salutation
16:07:55.14 (92077124)|USER_DEBUG|[6]|DEBUG|field: Name
16:07:55.14 (92106382)|USER_DEBUG|[6]|DEBUG|field: RecordTypeId
16:07:55.14 (92134512)|USER_DEBUG|[6]|DEBUG|field: OtherStreet
16:07:55.14 (92160046)|USER_DEBUG|[6]|DEBUG|field: OtherCity
16:07:55.14 (92189198)|USER_DEBUG|[6]|DEBUG|field: OtherState
16:07:55.14 (92214368)|USER_DEBUG|[6]|DEBUG|field: OtherPostalCode
16:07:55.14 (92238796)|USER_DEBUG|[6]|DEBUG|field: OtherCountry
16:07:55.14 (92263303)|USER_DEBUG|[6]|DEBUG|field: OtherLatitude
16:07:55.14 (92287472)|USER_DEBUG|[6]|DEBUG|field: OtherLongitude
16:07:55.14 (92312118)|USER_DEBUG|[6]|DEBUG|field: OtherGeocodeAccuracy
16:07:55.14 (92337971)|USER_DEBUG|[6]|DEBUG|field: OtherAddress
16:07:55.14 (92366249)|USER_DEBUG|[6]|DEBUG|field: MailingStreet

So, Contact object has the following fields (for example): LastName, FirstName, MailingStreet.

When I go to Setup and try to find those fields they do not come up in the Object Manager, while I thought that I should be able to see all fields in OM. enter image description here

So, where do those fields come from or why don`t I see them in OM?

Thank you.

1 Answer 1


MailingAddress is a compound field, whose type, as you see in Object Manager, is Address.

What you're getting back from the Describe API includes both the components of the compound field, such as MailingStreet, MailingCity, and so on, as well as the compound field itself, MailingAddress. In Object Manager, only the parent compound field is displayed.

Compound fields (Addresses and Geolocations) have some unique characteristics. They're always read-only as compound fields, but their component fields may be writable. You can read more about them in the SOAP API developer guide:

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.

There are two compound Address fields on the Contact object and two on the Account object, as well as a few others elsewhere in the data model (note that link is the Spring '14 release notes and some other information there has been superseded). Addresses exist only as standard fields; you can create custom Geolocation fields.

You can identify Address fields by calling getType() on their DescribeFieldResult, which will return "ADDRESS". The component fields will return their proper types ("STRING", etc).

Name is a core field on Salesforce objects and it sometimes has special rules. For the Contact, Name is treated like a compound field, whose components are FirstName and LastName. The same is true of the Name field for Person Accounts.

API-only Compound Detection

If you're working with the REST API Describe information, you can access a key compoundFieldName within the information describing each field. A field Some_API_Name__c is compound if any other field on the same object has Some_API_Name__c in its compoundFieldName slot.

  • Yes, I've extended my answer.
    – David Reed
    Nov 18, 2018 at 16:29
  • Hm. That is clear that I can check whether or not the field is of type Address. But what about a general approach here? Is it possible to tell for any Schema.SObjectField whether it is compound or not? Nov 18, 2018 at 16:33
  • I don't think there's any method that encapsulates all of the special cases. For example, Name on Contact has the Type and SOAP Type "String", even though it is behaving like a compound field.
    – David Reed
    Nov 18, 2018 at 16:52

You must log in to answer this question.

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