Basically, we have this object: Animal. And Animal has a few fields, Number_Of_Legs, Warm_Or_Cold_Blooded, etc and I basically want to automatically map the names and corresponding values into a map.
That way, as we added more fields, we wouldn't have to update the code.
Currently, we have:
Map <String, Schema.SObjectField> fieldMap = Animal__c.getSobjectType().getDescribe().fields.getMap();
Map<String, Integer> animalQualities = new Map<String, Integer>();
for(String field : fieldMap.keySet()){
//animal passed in prior...
animalQualities.put(field, animal.getFieldValueOf(field));
}
animal.getFieldValueOf(field) isn't a real function, but is there something similar that already exists?