• CPR
  • NEWBIE
  • 0 Points
  • Member since 2013

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 4
    Replies
Hello,

Here is my test class which I am getting Attempt to de-reference a null object. Not sure what's wrong. Any help to resovle this error will be appreciated. So there is VF page where users enters start date and end date with datatime data type, and based on these dates, clickout records should be fetched and printed as pdf.

Public Static TestMethod void test1(){
        init();   // this method creates the required data like opp, account, contact, etc.
           
        clickO.CLICK_OUT_DATE__C = system.now(); // error on this line "FATAL_ERROR|System.NullPointerException: Attempt to de-reference a null object"
        clickO.RELATED_MERHCANT__C = 'abcd';
        clickO.MERCHANT_OF_THE_DAY__C = true;
        clickO.MERCHANT_OF_THE_WEEK__C= false;
        clickO.COST_PER_CLICK__C= 0.33;
        insert clickO;
       
       clickO.CLICK_OUT_DATE__C = system.now();
        clickO.RELATED_MERHCANT__C = 'abcd';
        clickO.MERCHANT_OF_THE_DAY__C = false;
        clickO.MERCHANT_OF_THE_WEEK__C= true;
        clickO.COST_PER_CLICK__C= 0.33;
        insert clickO;
       
       clickO.CLICK_OUT_DATE__C = system.now();
        clickO.RELATED_MERHCANT__C = 'abcd';
        clickO.MERCHANT_OF_THE_DAY__C = false;
        clickO.MERCHANT_OF_THE_WEEK__C= false;
        clickO.COST_PER_CLICK__C= 0.33;
        insert clickO;          
            
        Test.startTest();
            ApexPages.StandardController scon = new ApexPages.StandardController(opp);
            OpportunityPDFController pdfC = new OpportunityPDFController(scon);
          
            pdfC.billing.Billing_Cycle_Start_Date__c = system.now();
            pdfC.billing.Billing_Cycle_end_Date__c = system.now().addDays(8);
            pdfc.billing.refund__c=12;
           
            pdfc.refund=2;
           
            pdfC.refreshCheckout(); // This method refresh the vf page, and display all the click out records between start date and end date
            pdfC.generatePDF();  // This method generates pdf.
           
            pdfC.generatePDFBill();
            pdfC.savePDF();
            ApexPages.currentPage().getParameters().get(pdfC.billing.id);
            pdfC.refreshCheckoutPDF();
           
        Test.stopTest();
   
    }
  • April 17, 2014
  • Like
  • 0

I am trying to configure SSO using Okta as Identity Provider. I am testing SSO in Sandbox and found one of the feature is missing in Sandbox. 

When we configure My Domain, in production we have option to select  

 

Use the following Authentication Service: My SAML IDP or Login Page. 


However, same option is not available in Full copy Sandbox when I created My Domain in Sandbox. 

Could you please let me know how to enable this feature in Sandbox? 

Appreciate your help. 

 

 

  • September 25, 2013
  • Like
  • 0
Hello,

Here is my test class which I am getting Attempt to de-reference a null object. Not sure what's wrong. Any help to resovle this error will be appreciated. So there is VF page where users enters start date and end date with datatime data type, and based on these dates, clickout records should be fetched and printed as pdf.

Public Static TestMethod void test1(){
        init();   // this method creates the required data like opp, account, contact, etc.
           
        clickO.CLICK_OUT_DATE__C = system.now(); // error on this line "FATAL_ERROR|System.NullPointerException: Attempt to de-reference a null object"
        clickO.RELATED_MERHCANT__C = 'abcd';
        clickO.MERCHANT_OF_THE_DAY__C = true;
        clickO.MERCHANT_OF_THE_WEEK__C= false;
        clickO.COST_PER_CLICK__C= 0.33;
        insert clickO;
       
       clickO.CLICK_OUT_DATE__C = system.now();
        clickO.RELATED_MERHCANT__C = 'abcd';
        clickO.MERCHANT_OF_THE_DAY__C = false;
        clickO.MERCHANT_OF_THE_WEEK__C= true;
        clickO.COST_PER_CLICK__C= 0.33;
        insert clickO;
       
       clickO.CLICK_OUT_DATE__C = system.now();
        clickO.RELATED_MERHCANT__C = 'abcd';
        clickO.MERCHANT_OF_THE_DAY__C = false;
        clickO.MERCHANT_OF_THE_WEEK__C= false;
        clickO.COST_PER_CLICK__C= 0.33;
        insert clickO;          
            
        Test.startTest();
            ApexPages.StandardController scon = new ApexPages.StandardController(opp);
            OpportunityPDFController pdfC = new OpportunityPDFController(scon);
          
            pdfC.billing.Billing_Cycle_Start_Date__c = system.now();
            pdfC.billing.Billing_Cycle_end_Date__c = system.now().addDays(8);
            pdfc.billing.refund__c=12;
           
            pdfc.refund=2;
           
            pdfC.refreshCheckout(); // This method refresh the vf page, and display all the click out records between start date and end date
            pdfC.generatePDF();  // This method generates pdf.
           
            pdfC.generatePDFBill();
            pdfC.savePDF();
            ApexPages.currentPage().getParameters().get(pdfC.billing.id);
            pdfC.refreshCheckoutPDF();
           
        Test.stopTest();
   
    }
  • April 17, 2014
  • Like
  • 0

Hi,

 

I'm having problem with this approach for creating invoiceLineItems, ultimately this is giving me an error saying that System.ListException: Before Insert or Upsert list must not have two identically equal elements..

now bellow is the code. if any one has any of the solutions that plz let me know.

          

 

       for(opportunityLineItem olis : opportunityLineItems)

                            Date WeekStartDate = olis.StartDate__c.date();
                            Date WeekEndDate = olis.EndDate__c.date();
                            Interval = startDate.daysBetween(endDate) / 7;
                          
                            if(interval == 0){
                               interval = 1;
                            }
                           
                           
                            for(integer i = 0; i < interval; i++){
                                InvoiceLineItem__c invoiceLineItem = new InvoiceLineItem__c();
                                if(interval > 1){
                                    invoiceLineItem.StartDate__c = WeekStartDate.addDays(sdays1);
                                    invoiceLineItem.EndDate__c = WeekStartDate.addDays(edays2);
                                    sdays1 = sdays1 + 7;
                                    edays2 = edays2 + 7;
                                }
                                else{
                                    invoiceLineItem.StartDate__c = WeekStartDate;
                                    invoiceLineItem.EndDate__c = WeekEndDate;
                                  
                                }
                                oliIli.add(new opportunityLineItemInvoiceLineItemWrapper(invoiceLineItem, olis));
                              
                            }

 

              }

 

 

 

Thanks in Advance...  :)

  • November 26, 2013
  • Like
  • 0

I am trying to configure SSO using Okta as Identity Provider. I am testing SSO in Sandbox and found one of the feature is missing in Sandbox. 

When we configure My Domain, in production we have option to select  

 

Use the following Authentication Service: My SAML IDP or Login Page. 


However, same option is not available in Full copy Sandbox when I created My Domain in Sandbox. 

Could you please let me know how to enable this feature in Sandbox? 

Appreciate your help. 

 

 

  • September 25, 2013
  • Like
  • 0