Salesforce: Accessing Field label of object in VisualForce page

In VFPage one can directly access the label of any particular field of sObject. In future if the label is changed in the sObject, same will be reflected in the VFPage.

For Example:

<apex:column title=”{!$ObjectType.OpportunityLineItem.fields.Quantity.label}” headerValue=”{!$ObjectType.OpportunityLineItem.fields.Quantity.label}” width=”50px”>

It also avoids hard-coded labels and make it more flexible.

Leave a Reply