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
Post a Comment