• Ross Bai18
  • NEWBIE
  • 0 Points
  • Member since 2017
  • developer

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 2
    Replies
hi, i have issue for this apex code.

loAccount2ndList is actually has the data return, but for some reason, when the code with loAccount2nd.size() > 0 logic, it seems not able to return any data but null.

i am just wondering if there is the way to query pass to the reference and having loAccount2ndList[0].value able to get some value.

many thanks.
 
public with sharing class PCL2CreateSessionImportData {

    public Account getAccount()  
       {
       
       oppId = Apexpages.currentpage().getparameters().get('id');
       
       List<Account> loAccount2ndList = [SELECT Id,OwnerId,PersonContactId,FirstName,LastName,,Outstanding_Judgements_Value__c,US_Citizenship_Value__c   
       FROM Account WHERE PersonContactId in (SELECT ContactId FROM OpportunityContactRole WHERE Role = 'Realtor' AND OpportunityId = : oppId) and IsPersonAccount = true LIMIT 1];
       
       if(loAccount2ndList.size()>0)
           loAccount2nd=loAccount2ndList[0];
       else
           loAccount2nd = new Account(); 
       return loAccount2nd;
       
       }


    public HttpResponse parseCreateSessionImportData() {

        String oppId = Apexpages.currentpage().getparameters().get('id');

        List<Account> loAccount2nd = new List<Account>();

        String RealtorEmail;  

        if (loAccount2nd.size() > 0 && loAccount2nd[0].PersonEmail != null) RealtorEmail = '                                                                                '.substring(0, (80-string.valueof(loAccount2nd[0].PersonEmail).length())) + loAccount2nd[0].PersonEmail; else RealtorEmail = '                                                                                '.substring(0,80);
  
    }

}








 
hi, i have issue for this apex code.

loAccount2ndList is actually has the data return, but for some reason, when the code with loAccount2nd.size() > 0 logic, it seems not able to return any data but null.

i am just wondering if there is the way to query pass to the reference and having loAccount2ndList[0].value able to get some value.

many thanks.
 
public with sharing class PCL2CreateSessionImportData {

    public Account getAccount()  
       {
       
       oppId = Apexpages.currentpage().getparameters().get('id');
       
       List<Account> loAccount2ndList = [SELECT Id,OwnerId,PersonContactId,FirstName,LastName,,Outstanding_Judgements_Value__c,US_Citizenship_Value__c   
       FROM Account WHERE PersonContactId in (SELECT ContactId FROM OpportunityContactRole WHERE Role = 'Realtor' AND OpportunityId = : oppId) and IsPersonAccount = true LIMIT 1];
       
       if(loAccount2ndList.size()>0)
           loAccount2nd=loAccount2ndList[0];
       else
           loAccount2nd = new Account(); 
       return loAccount2nd;
       
       }


    public HttpResponse parseCreateSessionImportData() {

        String oppId = Apexpages.currentpage().getparameters().get('id');

        List<Account> loAccount2nd = new List<Account>();

        String RealtorEmail;  

        if (loAccount2nd.size() > 0 && loAccount2nd[0].PersonEmail != null) RealtorEmail = '                                                                                '.substring(0, (80-string.valueof(loAccount2nd[0].PersonEmail).length())) + loAccount2nd[0].PersonEmail; else RealtorEmail = '                                                                                '.substring(0,80);
  
    }

}