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 posts from this blog

Salesforce Spring 16 Release Exam (Maintenance Exam Q&A) for Developer 201 Admin

Show Hyper Link On Add Error in Salesforce Trigger

Show the Success Message before Redirecting the Detail page on Visualforce Page