You need to sign in to do that
Don't have an account?
hamza akouayri
Valid SOQL query returning zero results in apex class but it return expected results in developer console
I have valid soql query returning zero results in apex class but it return expected results in developer console - FYI i have tried to running both context with sharing and without sharing still no result. any idea
@InvocableMethod(label='Get User info') public static List<userOutput> getUserLogedInInfo(List<userInput> inputParameters){ List<userOutput> outputParameters = new List<userOutput>(); userOutput outputParameter = new userOutput(); String sEmail = inputParameters[0].sEmail; String sContact = null; String sUser = null; List <User> userList = [SELECT Id, FirstName, LastName, Email,ContactID FROM USER WHERE Email = :sEmail]; System.debug('###### User####'+userList); if (userList.size()>0){ sContact = userList[0].ContactId; System.debug('###### UserId####'+ userList[0].Id); List <AuthSession> auth = [SELECT Id, UsersId, IsCurrent FROM AuthSession WHERE IsCurrent = True AND UsersId = : userList[0].Id LIMIT 1]; System.debug('###### auth####'+auth); if (auth.size()>0){ System.debug('i am here'+ outputParameter.sLogin); outputParameter.sLogin = True; } } outputParameters.add(outputParameter); return outputParameters; }
Have you checked suggestion for similar question?
https://salesforce.stackexchange.com/questions/214664/valid-soql-query-returning-zero-results-in-class-but-expected-results-in-develop
Thanks!
in your test method