Skip to main content
It is showing attempt to dereference null object error

 

vfpage controller

 

global class Search_Account_Controller {

 

   public Set<string> accountSet{get;set;}

 

   public string accName{get;set;}

 

   public Account accObj{get;set;}

 

   public List<Opportunity> oppList{get;set;}

 

   public boolean recTypeCheck{get;set;}

 

   public List<Service__c> serviceList{get;set;} 

 

   

 

    public Search_Account_Controller() {

 

         recTypeCheck=true;

 

        accountSet = new Set<String>();

 

        List<Account> accList = [Select id, Name, Account_Type__c from Account LIMIT 30000];

 

        if(accList!=null && accList.size()>0){

 

            for(Account acc :accList){

 

                accountSet.add(acc.Name);

 

            }

 

        }

 

    }

 

    

 

     public void getAccountDetails(){

 

        oppList = new List<Opportunity>();

 

        serviceList= new List<Service__c>();

 

         List<Account> accList= [Select Name, Id, Account_Type__c from Account where Name=:accName LIMIT 1];

 

         

 

         if(accList!=null && accList.size()>0)

 

         accObj=accList[0];

 

         

 

        if(accObj.Account_Type__c!='Client')  {

 

             recTypeCheck=false;

 

         }

 

         else{

 

            oppList=[Select Id, OppNumber__c, FC_Opportunity_Status__c, Name, StageName, CloseDate, CreationDateTime__c from Opportunity where AccountId=:accObj.Id];    

 

         }

 

     }

 

     

 

     public void getLineItemDetails()  {

 

         String oppIdval = apexpages.currentpage().getparameters().get('OppId');

 

         serviceList=[Select Id, Product__c, Produkt_ID__c , Product__r.Name, Name from Service__c where Opportunity__c=:oppIdval];    

 

         

 

     }

 

}

 

 
10 answers