I'm trying to work with contacts in a salesforce org, where Person Accounts are enabled. Apparently, you can not query contacts anymore. A simple query like:
List<Contact> cs = [SELECT Id, LastName FROM Contact];
fails, because of:
Line: 1, Column: 15 Illegal assignment from List<Contact> to List<Contact>
List<Contact> cs = [SELECT Id, LastName FROM Contact WHERE IsPersonAccount = false];
also fails (same error). The query works as expected with the Query Editor, though. To make things even worse, when loading the records in
List<sObject> sobjs, I can not cast them later into contacts.
for (sObject obj : sObjs) System.debug(obj.getSObjectType());
returns "Contact", but
Contact c = (Contact) obj;
Incompatible types since an instance of SObject is never an instance of Contact. Needless to say, that I can not access any fields, and the code works perfectly when querying other sObjects such as leads.
Please help me :(