• andres guevara
  • NEWBIE
  • 0 Points
  • Member since 2023

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 0
    Questions
  • 1
    Replies
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;
  }