Skip to main content
I am trying to query and get field labels which contain DHC?

 

Can anyone help?

 

Thanks
1 réponse
  1. 28 oct. 2018, 06:35
    Hi Svi,

     

    I don't think so you can query directly the field label. Here is sample code that you can execute to get the field label.

     

     

    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();

    if(fieldMap.containsKey('DHC')){

    System.debug('##.Field Label Name='+fieldMap.get('DHC').getDescribe().getLabel());//It provides to get the object fields label.

    }

     

     
0/9000