• Sunil Bagul
  • NEWBIE
  • 0 Points
  • Member since 2014

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 1
    Replies
i want to find the label for field and i am using this code to find that,it is returning me label but for Type picklist lable is Type but it is returning Account Type,any help just to get label as Type?

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
 
System.debug(fieldMap.get(fieldName).getDescribe().getLabel());//It provides to get the object fields label.
}
i want to find the label for field and i am using this code to find that,it is returning me label but for Type picklist lable is Type but it is returning Account Type,any help just to get label as Type?

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
 
System.debug(fieldMap.get(fieldName).getDescribe().getLabel());//It provides to get the object fields label.
}