I have a custom profile called MyCustomProfile. When I want to get profiles in my Apex class I don't get System Administrator. But in Developer Console, with same code, I can get both of them.
Profile[] adminProfiles = [SELECT id FROM Profile WHERE name IN ('MyCustomProfile', 'System Administrator')];
returns one element from my Apex class and returns two records from Developer Console. Why can't I see the System Administrator in my class, also? Do you have any ideas?
EDIT: Code part I'm getting the issue.
User userObj = [SELECT ProfileId FROM User WHERE id=:UserInfo.getUserId()];
Profile[] adminProfiles = [SELECT id FROM Profile WHERE name IN ('Merkez Kullanıcıları', 'System Administrator')];
Map<id, Profile> lIDToProfileMap = new Map<id, Profile>(adminProfiles);
system.debug('returned map: ' + lIDToProfileMap);