I hope you'll help me to solve my problem :)
I've written a class that check if a Sobject has a field of a certain name
public static boolean hasSObjectField(String fieldName, SObject so){
return so.getSobjectType().getDescribe().fields.getMap().keySet().contains(fieldName);
}
It works very fine, but there is one fault: it does not check system fields such as, for example, OwnerId
.
Can you tell me what I've done wrong?
Regards!