I am trying to do get values from the object using string key, I have typecast the Contact object into the object but not getting value. Please help how to get value from the object using string API filed
List<String> lstfiedName = new List<String>{'LastName','Email','Phone'};
for(Contact objContact : lstofContact){
object obj = (object)objContact;
for(String fielName : lstfiedName){
System.debug('lastname::'+obj.get(fiedName));
}
}
Getting Error : Method does not exist or incorrect signature: void get(String) from the type Object