Hi All i'mI'm getting an error message when iI update my Contact name Error: first error: CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, UpdateCallsonContactNameChange: execution of AfterUpdate caused by: System.QueryException: Non-selective query against large object type (more than 100000 rows). Consider
CANNOT_INSERT_UPDATE_ACTIVATE_ENTITY, UpdateCallsonContactNameChange: execution of AfterUpdate caused by: System.QueryException: Non-selective query against large object type (more than 100000 rows).
Considered 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) Class.updatePhysiciansonContactNameChange.changeName: line 9, column 1 Trigger.UpdateCallsonContactNameChange: line 12, column 1
- The filter value includes null (for instance binding with a list that contains null)
- 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)
Second error: []"].
Class.updatePhysiciansonContactNameChange.changeName: line 9, column 1 Trigger.UpdateCallsonContactNameChange: line 12, column 1: []"].
ImI'm giving my Trigger and class to annalyse
trigger UpdateCallsonContactNameChange on Contact (after update) {analyze:
trigger UpdateCallsonContactNameChange on Contact (after update) {
if(updatePhysiciansNameonContactNameChange.RecursiveFlag)
{
updatePhysiciansNameonContactNameChange
.changeName(Trigger.NewMap.keyset(),Trigger.new,Trigger.oldMap);
}
}
}
MyIn the class is:the
PhysicianidPhysicianid
and Fellowid__cFellowid__c
are 2 lookup fields to the ContactContact
.
globalBelow is my class updatePhysiciansonContactNameChange {
Public static Boolean RecursiveFlag = true; public static void changeName(Set ids,List conlist,Map<Id, Contact> mapcontact) {:
global list<Call__c>class updatePhysiciansonContactNameChange
{
public static Boolean RecursiveFlag = true;
public static void changeName(Set<Id> ids, List<Contact> conlist,
Map<Id, Contact> mapcontact)
{
List<Call__c> listcall = [select Id,Physicians__c,Physicianid__c,
Fellowid__c,Fellow__c from call__c
where Physicianid__c in :Ids or Fellowid__c In :ids];
List<Call__c> updateCalls = new List<Call__c>();
for (Contact con : conlist ) {
Contact oldcon= mapcontact.get(con.Id);
if(con.FirstName != oldcon.FirstName || con.LastName != oldcon.LastName) {
for (Call__c casrecord:listcall){
if(casrecord.Physicianid__c==conPhysicianid__c == con.id)
{
casrecord.Physicians__c=conPhysicians__c = con.FirstName+'FirstName '+con+ ' ' + con.LastName;
}
else if(casrecord.Fellowid__c==conFellowid__c == con.id)
{
casrecord.Fellow__c=conFellow__c = con.FirstName+'FirstName '+con+ ' ' + con.LastName;
}
updateCalls.add(casrecord);
}
}
}
}
RecursiveFlag = false;
update updateCalls;
}
}
} }