• georgier
  • NEWBIE
  • 0 Points
  • Member since 2007

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 1
    Questions
  • 3
    Replies

I'm pretty new to Apex development and have had this error only happen once (while another user was entering data) and cannot replicate it. Any help would be greating appreciated.

 

This is the error...

 

--------------------------------------------------------------------------------------------------------

 

Apex script unhandled trigger exception by user/organization: 005600000013hcw/00D300000000GxO

HandlePartnerDiscountChange: execution of AfterUpdate

caused by: System.NullPointerException: Attempt to de-reference a null object

Trigger.HandlePartnerDiscountChange.processQuote: line 68, column 22
Trigger.HandlePartnerDiscountChange: line 14, column 13

 

--------------------------------------------------------------------------------------------------------

 

Here is the code that seems to be the issue....

 

--------------------------------------------------------------------------------------------------------

 

 

 

trigger HandlePartnerDiscountChange on Quote (after update) 

{    

    List<Product2>        prodList = [select ProductCode, Family, Volume_Discount_Allowed__c from Product2];

    List<QuoteLineItem>   qliList = [select QuoteId, ListPrice, Quantity, Description, Discount, UnitPrice, Manual_ARUS__c, Partner_Disc_Amt__c, Volume_Disc_Amt__c from QuoteLineItem where QuoteId in :trigger.newmap.keyset() order by QuoteId];

    String                lastId = '';

 

    // Cruise the list and process when the quote ID changes

    for( QuoteLineItem ql : qliList )

    {

        if( !lastId.equals(ql.QuoteId) )

        {

            lastId = ql.QuoteId;

            system.debug('-TPSDEBUG- processing qid "' + ql.QuoteId + '"');

            processQuote(ql.QuoteId);  // THIS IS LINE 14

        }

    }

 

    // When we're all done, we'll commit the list back to the database

    update qliList;

 

 

 

 

 

 

// Process a quote ID from the list
    static void processQuote(String qid)
    {
        Double totalAmount;
        Double volumeDiscount;
        
        // Figure the total *list* price for software and Engines 
        totalAmount = 0.0;
        
        for( QuoteLineItem ql : qliList )
        {
            // We're only paying attention to quotes for 'qid'
            if( qid.equals(ql.QuoteId) )
            {
                if( !ql.Description.contains('ARUS') &&  // THIS IS LINE 68
                    ( ql.Description.contains('W5-SDK') ||
                      ql.Description.contains('W5-CL') ||
                      ql.Description.contains('W5-SC') ) )
                {
                    totalAmount = totalAmount + (ql.ListPrice * ql.Quantity);
                }
            }

System Specs: Office 2007 on Windows 8 64-Bit

 

I'm able to connect to my sf just fine and see my custom objects, etc. When I run through the wizard and leave the Clause page blank it returns all of the records in the object just fine. The same goes for when I limit using number fields.

 

But when I put any type of limiting criteria that involve date fields, text fields, or picklist fields on the Clause page it returns 0 records.

 

For instance in both picklist and text fields I've tried using double quotes (Example = "In Training"), single quotes (Example = 'In Training'), and no quotes (Example = In Training). All return 0 records when I know that there are records that have the text "In Training" in this field.

 

Am I doing something wrong with entering criteria? Can someone please help provide a couple examples of successful query clauses that limit text, date, and picklist fields?

 

Thank you in advance!

I'm pretty new to Apex development and have had this error only happen once (while another user was entering data) and cannot replicate it. Any help would be greating appreciated.

 

This is the error...

 

--------------------------------------------------------------------------------------------------------

 

Apex script unhandled trigger exception by user/organization: 005600000013hcw/00D300000000GxO

HandlePartnerDiscountChange: execution of AfterUpdate

caused by: System.NullPointerException: Attempt to de-reference a null object

Trigger.HandlePartnerDiscountChange.processQuote: line 68, column 22
Trigger.HandlePartnerDiscountChange: line 14, column 13

 

--------------------------------------------------------------------------------------------------------

 

Here is the code that seems to be the issue....

 

--------------------------------------------------------------------------------------------------------

 

 

 

trigger HandlePartnerDiscountChange on Quote (after update) 

{    

    List<Product2>        prodList = [select ProductCode, Family, Volume_Discount_Allowed__c from Product2];

    List<QuoteLineItem>   qliList = [select QuoteId, ListPrice, Quantity, Description, Discount, UnitPrice, Manual_ARUS__c, Partner_Disc_Amt__c, Volume_Disc_Amt__c from QuoteLineItem where QuoteId in :trigger.newmap.keyset() order by QuoteId];

    String                lastId = '';

 

    // Cruise the list and process when the quote ID changes

    for( QuoteLineItem ql : qliList )

    {

        if( !lastId.equals(ql.QuoteId) )

        {

            lastId = ql.QuoteId;

            system.debug('-TPSDEBUG- processing qid "' + ql.QuoteId + '"');

            processQuote(ql.QuoteId);  // THIS IS LINE 14

        }

    }

 

    // When we're all done, we'll commit the list back to the database

    update qliList;

 

 

 

 

 

 

// Process a quote ID from the list
    static void processQuote(String qid)
    {
        Double totalAmount;
        Double volumeDiscount;
        
        // Figure the total *list* price for software and Engines 
        totalAmount = 0.0;
        
        for( QuoteLineItem ql : qliList )
        {
            // We're only paying attention to quotes for 'qid'
            if( qid.equals(ql.QuoteId) )
            {
                if( !ql.Description.contains('ARUS') &&  // THIS IS LINE 68
                    ( ql.Description.contains('W5-SDK') ||
                      ql.Description.contains('W5-CL') ||
                      ql.Description.contains('W5-SC') ) )
                {
                    totalAmount = totalAmount + (ql.ListPrice * ql.Quantity);
                }
            }