• ernesto truyen 11
  • NEWBIE
  • 0 Points
  • Member since 2019

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies

Hi,

 

I want to fetch the list of label names for all the fields of an Object....I got some code to get field labels of an Object 

 

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

 

But I want to get the list of all field labels by Apex..

I got the API name of all fields like this 

 

 String type='Account';

Map<String, Schema.SObjectType> schemaMap = Schema.getGlobalDescribe();
Schema.SObjectType leadSchema = schemaMap.get(type);
Map<String, Schema.SObjectField> fieldMap = leadSchema.getDescribe().fields.getMap();


for (String fieldName: fieldMap.keySet()) {

System.debug('##Field API Name='+fieldName);// list of all field API name
}

 

 

 

But I need to get the label name..

 

Please help

  • January 20, 2012
  • Like
  • 1