• EvdHurk
  • NEWBIE
  • 0 Points
  • Member since 2011
  • International Salesforce Coordinator

  • Chatter
    Feed
  • 0
    Best Answers
  • 0
    Likes Received
  • 0
    Likes Given
  • 2
    Questions
  • 3
    Replies
Hi,

We suddenly run in a problem. Code below functioned perfectly for more than 2 years. Now it errors with following message:

Any ideas?

Error: Invalid Data. Review all error messages below to correct your data. Apex trigger beforeInsert_QuoteLineItem caused an unexpected exception, contact your administrator: beforeInsert_QuoteLineItem: execution of BeforeInsert caused by: System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider an indexed filter or contact salesforce.com about custom indexing. Even if a field is indexed a filter might still not be selective when: 1. The filter value includes null (for instance binding with a list that contains null) 2. Data skew exists whereby the number of matching rows is very large (for instance, filtering for a particular foreign key value that occurs many times): Trigger.beforeInsert_QuoteLineItem: line 21, column 1

trigger beforeInsert_QuoteLineItem on QuoteLineItem (before insert) {  Map<String, QuoteLineItem> qli_to_insert = new Map<String, QuoteLineItem>();    Quote related_quote = [SELECT Id, Opportunity_Quote_nummer__c FROM Quote WHERE Id=:Trigger.new[0].QuoteId];  Integer quote_version = Integer.valueOf(related_quote.Opportunity_Quote_nummer__c);    //Get the oppty line items to insert where servicedate is created by a quote line item  for(QuoteLineItem quote_li:Trigger.new)  {    if(quote_li.ServiceDate != null)    {      if(quote_li.ServiceDate.Year() != (2000 + quote_version))      {        qli_to_insert.put(quote_li.sync_key__c, quote_li);      }    }  }    if(qli_to_insert.size()>0)  {    OpportunityLineItem[] related_oli = [SELECT Id, sync_key__c, of_Months__c, of_Users__c, Discount_valuta_line__c,                        Expected_delivery_date__c, Price_Unit1__c, Recurring__c, Total_Cost_of_Sales_Copy__c,                           Total_Gross_Margin_Copie__c, Description FROM OpportunityLineItem WHERE sync_key__c IN :qli_to_insert.keySet()];    if(related_oli.size()>0)    {      for(OpportunityLineItem oli:related_oli)      {        QuoteLineItem curr_qli = qli_to_insert.get(oli.sync_key__c);        curr_qli.of_Months__c = oli.of_Months__c;         curr_qli.of_Users__c = oli.of_Users__c;         curr_qli.Discount_Amount__c = oli.Discount_valuta_line__c;         curr_qli.Expected_delivery_date__c = oli.Expected_delivery_date__c;         curr_qli.Price_Unit1__c = oli.Price_Unit1__c;         curr_qli.Recurring__c = oli.Recurring__c;         curr_qli.Total_Cost_of_Sales_Copy__c = oli.Total_Cost_of_Sales_Copy__c;        curr_qli.Total_Gross_Margin_Copy__c = oli.Total_Gross_Margin_Copie__c;         curr_qli.Description = oli.Description;      }    }  }

Hi,

 

I am starting with a Apex trigger and want to update the Opportunity owner to Account owner before insert.

Does anybody has a code to get me starting?

 

Tnx in advance

As of today, I cannot deploy change sets from my sandbox to the production site. I get emails that the upload worked but it just doesnt apper in the list of inbound change sets.  Any Infos about this issue? 

Hi,

 

I am starting with a Apex trigger and want to update the Opportunity owner to Account owner before insert.

Does anybody has a code to get me starting?

 

Tnx in advance