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
PapsakPPapsakP 

Critical (please help!) - my company cannot work at all

I need a saviour here! I am really stuck. I imported alot of data today, after which my users started receiving the following error when saving records (contact records, and listing records)

"Apex script unhandled trigger exception by user/organization: 005b0000000F9Kc/00Db0000000JqlC
 
ListingTrigger_Clone: execution of BeforeUpdate
 
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.ListingTrigger_Clone: line 111, column 1"

Yes i understand this error and have done the research on it. Eventually to allow my company to continue working, i deleted all the data that i imported, and the bizarre thing is that this error still occurs. I have no clue what the problem could be, there is now currently not one object in the system that has more than 100 000 rows, so how is it possible that more than 100 000 are being returned? Especially considering that everything was working fine before importing the data. Error started occuring after data import, then i undid the data import yet error still remains.

Please help!

The code on line 111 above is the following:


 if(Trigger.IsBefore){       system.debug('setPropertyOwner++-->'+setPropertyOwner);                Map<Id,contact> mapPropertyOwnerContacts = New Map<Id,contact>([SELECT Id,Name,MobilePhone,Email,Work_Title__c,FirstName,LastName,             Last_Enquired_Date__c,Max_Price__c,Area_Multi__c,Bedrooms__c, ContactType__c,Preferred_Finance__c, Buyer_Source__c,               Buying_Temperature__c,Set_Listing_Matchings_to_Do_not_call__c FROM Contact WHERE Id in: setPropertyOwner or Name =: UserInfo.getName()               or (Buying_Temperature__c <> 'Not Looking' AND Set_Listing_Matchings_to_Do_not_call__c = FALSE                AND Bedrooms__c <> null AND Max_Price__c <> null AND Area_Multi__c <> null)]);         for(Contact objCon: mapPropertyOwnerContacts.values()){             if(setPropertyOwner.size()>0 && setPropertyOwner.contains(objCon.Id)){                 mapPropertyOwnerContact.put(objCon.Id,objCon);             }             if(objCon.Name == UserInfo.getName()){                 callerContact.Add(objCon);             }             if(objCon.Buying_Temperature__c != 'Not Looking' && objCon.Set_Listing_Matchings_to_Do_not_call__c == FALSE                && objCon.Bedrooms__c != null && objCon.Max_Price__c != null && objCon.Area_Multi__c != null){                 contacts.Add(objCon);             }         }     }    



 
Abhishek BansalAbhishek Bansal
Have you removed it from recycle bin also.
If not than please empty your recycle bin also.
May be that will help you out.

Thanks,
Abhishek
PapsakPPapsakP
I did try that thanks Kind Regards, Dale Purdon Director IMAGINE Property Investments Tel: 072 290 2080 Fax: 0866 504 957 www.ImagineProperty.co.za [Description: dale-footer-style]