Get Field Label With API name using Describe Call




Map<String,String> mapFieldLebelToApiName = new Map<String,String>();



Map<String, Schema.SObjectField> fieldsMap = Schema.SObjectType.SobjectName.fields.getMap();
      system.debug('fieldsMap****'+fieldsMap);
       system.debug('fieldsMapvalues****'+fieldsMap.values());
      for (Schema.SObjectField field : fieldsMap.values()){
      
           mapFieldLebelToApiName .put(field.getDescribe().getLabel(), field.getDescribe().getName());
        
          
      }   

Comments

Popular Post

Use Of Standard Set Of Controller

How to remove and Delete row from PageBlock table on VF page

Show Pagination and Colum Sorting on VF page using Jquery Plugin