0

Please find below class where I get Null Pointer Exception while assigning value to boolean. Please let me know where is my fault here? Thanks!

Apex Class:

public class CallReplica_controller 
 {

    public CallReplica_controller() {

    }



     public String Ids {get;set;}   
      public String CallId {get;set;}
      public List<Call2_vod__c> CList{get;set;} 
      public List<Call2_vod__c> Accts{get;set;}
      Public Set<Id> Acc;  
      Public Boolean SameSize{get;set;}  
      Public Id leadId {get;set;}

      public CallReplica_controller (ApexPages.StandardController controller)//Constructor
  {  SameSize=false;
  String id =ApexPages.currentPage().getParameters().get('id');//Call id
  CList=[SELECT Account_vod__c, Account_vod__r.Name,Account_Plan_vod__c, Activity_Type__c, Add_Detail_vod__c, Address_vod__c, Address_Line_1_vod__c, Address_Line_2_vod__c, Attendee_Associated_Prescriber_CIA__c, Assignment_Datetime_vod__c, Associated_Prescriber_CIA__c, Allowed_Products_vod__c, Attendee_Associated_Prescriber_ABS_CIA__c, Associated_Prescriber_ABS_CIA__c, Attendee_Post_Status_vod__c, Attendee_Role_CIA__c, Attendee_Type_vod__c, Attendees_vod__c, Breakthrough_Activity_MHC__c, CIA_Switched_Calls_CIA__c, Business_Account_Name_ABT__c, CLM_vod__c, Number_of_CRNA_abt__c, zvod_Call_Conflict_Status_vod__c, Owner_Full_Name_abv__c, Call_Role_Header_CIA__c, City_vod__c, Color_vod__c, Credentials_vod__c, CreatedDate, CreatedById, Contract_Next_Steps_MHC__c, Contact_vod__c, Call_Date_vod__c, Call_Datetime_vod__c, IsDeleted, Deliver_Any_Day_abv__c, Delivery_Day_abt__c, Delivery_Day_2_abt__c, Delivery_Day_3_abt__c, Delivery_Day_4_abt__c, Disbursed_To_vod__c, Detailed_Products_vod__c, Duration_vod__c, Disclaimer_vod__c, Entity_Display_Name_vod__c, Entity_Reference_Id_vod__c, Error_Reference_Call_vod__c, Expense_Amount_vod__c, Expense_Attendee_Type_vod__c, Expense_Post_Status_vod__c, Expense_System_External_ID_vod__c, Getting_Started_Kits_ABT__c, Formatted_Name__c, Attendee_Affirmation_CIA__c, Affirmation_CIA__c, Incurred_Expense_vod__c, IsLocked, Is_Parent_Call_vod__c, Is_Sampled_Call_vod__c, Interaction_abt__c, License_Status_ABT__c, License_Expiration_Date_vod__c, License_Expiration_Date_ABT__c, License_ABT__c, Location_Services_Status_vod__c, zvod_Business_Account_vod__c, MAX_ID_ABT__c, Number_of_MD_abt__c, MD_Time_abt__c, Medical_Event_vod__c, MayEdit, Next_Steps_Overall_abv__c, Next_Step_Overall_MHC__c, Modified_Call_Reference_HS__c, Mobile_Last_Modified_Datetime_vod__c, OwnerId, Override_Lock_vod__c, Attendee_list_vod__c, Parent_Address_vod__c, Parent_Call_vod__c, Parent_Call_Mobile_ID_vod__c, Number_of_Pharmacy_abt__c, Submit_DateTime_ABT__c, X24_X_7_nurse_phone_support_ABT__c, ASSMCA_vod__c, Add_Key_Message_vod__c, Assigner_vod__c, CRNA_Time_abt__c, Call_Sample_Update__c, Call_Comments_vod__c, Concur_Address_abv__c, Concur_Description_abv__c, DEA_vod__c, DEA_Address_vod__c, DEA_Address_Line_1_vod__c, DEA_Address_Line_2_vod__c, DEA_City_vod__c, DEA_Expiration_Date_vod__c, DEA_State_vod__c, DEA_Zip_vod__c, DEA_Zip_4_vod__c, HPP_DMARD_Benefit_ABT__c, HPP_copay_support_ABT__c, HPP_foundation_support_ABT__c, Insurance_process_support_ABT__c, LastActivityDate, Last_Device_vod__c, Last_Modified_By__c, LastModifiedById, LastModifiedDate, License_vod__c, License_Status_vod__c, Location_vod__c, Medication_reminders_ABT__c, Mobile_Created_Datetime_vod__c, Mobile_ID_vod__c, Next_Call_Notes_vod__c, No_Disbursement_vod__c, Name, Nurse_injection_training_ABT__c, Original_Call_Reference_HS__c, Number_of_Other_HCPs_abt__c, Other_HCP_Time_abt__c, Pharmacy_Time_abt__c, Planning_Time_abt__c, Pre_Call_Notes_vod__c, Presentations_vod__c, Product_Priority_1_vod__c, Product_Priority_2_vod__c, Product_Priority_3_vod__c, Product_Priority_4_vod__c, Product_Priority_5_vod__c, Professional_Abbott_Best_Specialty_ABT__c, Professional_Degree_ABT__c, Professional_First_Name_ABT__c, Professional_Last_Name_ABT__c, Professional_ME_ABT__c, Professional_Middle_Name_ABT__c, Professional_Salutation_ABT__c, Professional_Status_ABT__c, Professional_Type_ABT__c, Property_vod__c, Number_of_RN_cia__c, RN_Time_cia__c, Id, RecordTypeId, Salesforce_ABT__c, Salutation_vod__c, Sample_Card_vod__c, Sample_Card_Reason_vod__c, Sample_Send_Card_vod__c, Sharps_containers_ABT__c, Sharps_mailback_services_ABT__c, Ship_Address_Line_1_vod__c, Ship_Address_Line_2_vod__c, Ship_City_vod__c, Ship_Country_vod__c, Ship_License_vod__c, Ship_License_Expiration_Date_vod__c, Ship_License_Status_vod__c, Ship_State_vod__c, Ship_To_Address_Text_vod__c, Ship_To_Address_vod__c, Ship_Zip_vod__c, Ship_Zip_4_vod__c, Signature_vod__c, Signature_Date_vod__c, Signature_Location_Latitude_vod__c, Signature_Location_Longitude_vod__c, Signature_Page_Image_vod__c, Signature_Timestamp_vod__c, Significant_Event__c, Site_Onboarding_Next_Steps_abv__c, State_vod__c, Status_vod__c, Subject_vod__c, Submitted_By_Mobile_vod__c, Supervising_Physician_vod__c, Supervising_Physician_Credential_vod__c, Supervising_Physician_License_vod__c, Supervising_Physician_Name_vod__c, SystemModstamp, Territory_vod__c, Total_Expense_Attendees_Count_vod__c, Travel_Time_abt__c, Call_Type_vod__c, USHCP_abv__c, Uncovering_Needs_abt__c, Unlock_vod__c, User_vod__c, Zip_vod__c, Zip_4_vod__c, myHUMIRA_Overview_ABT__c, zvod_Account_Call_Reminder_vod_c_vod__c, zvod_Account_Credentials_vod_c_vod__c, zvod_Account_Preferred_Name_vod_c_vod__c, zvod_Address_vod_c_DEA_Status_vod_c_vod__c, zvod_Account_Sample_Status_vod_c_vod__c, zvod_Attachments_vod__c, zvod_Attendees_vod__c, zvod_CLMDetails_vod__c, zvod_Entity_vod__c, zvod_Call_Objective_vod__c, zvod_Delete_vod__c, zvod_Detailing_vod__c, zvod_Expenses_vod__c, zvod_Followup_vod__c, zvod_Key_Messages_vod__c, zvod_More_Actions_vod__c, zvod_Product_Discussion_vod__c, zvod_Samples_vod__c,
  zvod_Save_vod__c, zvod_SaveNew_vod__c, zvod_Submit_vod__c, zvod_Surveys_vod__c FROM Call2_vod__c where id=:id];

  System.debug('My call-->'+CList);

  if(CList.get(0).Parent_call_vod__c!=null)
  { Accts=[select Account_vod__c,Id from Call2_vod__c where Parent_call_vod__c=:CList.get(0).Parent_call_vod__c];
    For(Call2_vod__c c: Accts)
      { Acc.add(c.Account_vod__c);
       }
       Acc.add(CList.get(0).Account_vod__c);
  }

   List<UserRecordAccess> HasAccessList = [SELECT RecordId, HasReadAccess FROM UserRecordAccess WHERE UserId=:UserInfo.getUserId() AND RecordId IN :Acc LIMIT 200];
      If(HasAccessList.size() == Acc.size()) // **This Line throws Error!**
       {SameSize=true;}

      }


   public PageReference getredirectPage(){
      // string leadId = '';
       if(SameSize){
          leadId = CList.get(0).Parent_call_vod__c;

       PageReference send = new PageReference('/' + leadId);
       send.setRedirect(true);
       return send;  

       }

       else return null;   
   }
    }
  • 1
    Please remove as much irrelevant code as possible. If you want us to put work into helping you, put some work into helping us. – Adrian Larson Jul 22 '15 at 17:04
  • Sorry Adrian. Will surely do do next – Testing_SFDC Jul 22 '15 at 17:06
1

You haven't initialized Acc. Place Acc = new Set<Id>(); in your constructor.

  • It throws this Error:- Compile Error: expecting a left angle bracket, found '(' at line - Acc = new Set(); – Testing_SFDC Jul 22 '15 at 16:09

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.