function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Shawn C KingShawn C King 

Error on SOQL triggger

I getting this error:

 

CreateTaskonCloseofDateEscrow45DayCall: execution of AfterUpdate  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, filterin

 

on a SOQL trigger where I use this statement:

List<BeazerLot__c> ownerid = [SELECT OwnerId FROM BeazerLot__c WHERE DefaultCaseOwner__c =: defaultcaseowner AND AddressLine1__c =: address LIMIT 1];

 

I'm new to SalesForce can someone help me with this error

 

 

Satish_SFDCSatish_SFDC

From the docs at this link: http://www.salesforce.com/us/developer/docs/apexcode/Content/langCon_apex_SOQL_VLSQ.htm

 

For best performance, SOQL queries must be selective, particularly for queries inside of triggers. To avoid long execution times, non-selective SOQL queries may be terminated by the system. Developers will receive an error message when a non-selective query in a trigger executes against an object that contains more than 100,000 records. To avoid this error, ensure that the query is selective.

 

How to make a query selective.

 

http://help.salesforce.com/apex/HTViewSolution?id=000006044&language=en_US

 

Regards,
Satish Kumar
Please mark my answer as a solution if it was helpful so it is available to others as a proper solution.
If you felt I went above and beyond, please give me Kudos by clicking on the star icon.