I have tried fetching field Labels dynamically in my Visualforce page and apex class through Field Describe, but its been really annoying for me to fix this situation where field Labels are extraordinarily different from what they are shown on Page Layout for the field.

For eg: If the code used in VF page to fetch field Labels is:

  1. {!$ObjectType['Task'].fields['ActivityDate'].label}
  2. {!$ObjectType['Task'].fields['CreatedById'].label}

Then I get values as:

  1. Due Date Only
  2. Created By ID

These are odd labels for someone to see in the app when the Standard labels (as displayed on Detail Page Layouts) for these fields are:

  1. Due Date
  2. Created By

Why is this difference and how can I fix and fetch correct labels for fields dynamically?

1 Answer 1


Not all fields have a direct one to one correlation to their layout counterparts. For example, Created By is both the user that created the record and when it was created. Similarly, Name for leads and contacts is actually three fields compressed into one. These differences makes it hard to precisely replicate the standard rendering of page layouts. I personally ended up calling the REST API describe layout call to get a better label result, although I still had to render the name field specifically to get it to render correctly in edit mode.

  • 1
    But this is very strange. Why would describe call give label "Due Date Only" but layout shows "Due Date" ... :-( ... What workaround is there to get actual labels shown on layout?
    – VarunC
    Feb 27, 2015 at 20:37

You must log in to answer this question.

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