+ Start a Discussion
Gourav JainGourav Jain 

We can use the following syntax to retrieve the label of custom field on VF page.

Example: $ObjectType.Object__c.Fields.CustomField__c.Label

But, How to retrieve Label of Custom Field in Apex class?

Best Answer chosen by Admin (Salesforce Developers) 
rohitsfdcrohitsfdc

hi,

You can access the label using describe method

 

Schema.DescribeFieldResult F = contact.activate__c.getDescribe();
string a = f.getLabel();