You need to sign in to do that
Don't have an account?

Apex Class does not return list of record
Working as SystemAdmin,
No triggers are active,
No triggers are active,
public class S_4_ContactListController { @AuraEnabled public static List<Contact> getContactList(){ list<Contact> contactList = new List<Contact>([Select Id, FirstName,LastName, Email, Phone From contact Where Email != null]); // contactList = [Select Id, FirstName,LastName, Email, Phone From contact Where Email != null]; return contactList; } }
Not sure with your problem, but if you are having same issue with the commented code as well, please check the Field_level Security for System Admin profile.
Hope this should work :)
query return records in query editor but when I try to execute the class method it does not show any record.
Since it's @AuraEnabled therefore calling in LEX component. Please check that method name is correct(exactly same as your apex class), when your are calling it from js controller. Also try append 'WithSharing' in your apex class for running apex code in User context.
Share your thoughts!
Thanks,
Sucharita
Nice thoughts, but Himanshu would have gotten the error saying- No method found if the method name in JS controller were different with the one shared here.