Skip to main content
Corrected the code formatting and some grammatical issues with the overall question. Corrected for coherency.
Source Link

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

  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)

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;
  }
}

} }

Hi All i'm getting an error message when i 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 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: []"].

Im giving my Trigger and class to annalyse

trigger UpdateCallsonContactNameChange on Contact (after update) {

 if(updatePhysiciansNameonContactNameChange.RecursiveFlag)   
{     
    updatePhysiciansNameonContactNameChange.changeName(Trigger.NewMap.keyset(),Trigger.new,Trigger.oldMap);   
      
    }

}

My class is: Physicianid and Fellowid__c are 2 lookup fields to the Contact.

global class updatePhysiciansonContactNameChange {

Public static Boolean RecursiveFlag = true; public static void changeName(Set ids,List 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==con.id)
          {                       
                casrecord.Physicians__c=con.FirstName+' '+con.LastName;
            }
            else if(casrecord.Fellowid__c==con.id)
            {
                   casrecord.Fellow__c=con.FirstName+' '+con.LastName;
             }
                   updateCalls.add(casrecord);           
           
          }

     }
 
} 
RecursiveFlag = false;
 update updateCalls;

} }

I'm getting an error message when I update my Contact name:

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)

Second error:

Class.updatePhysiciansonContactNameChange.changeName: line 9, column 1 Trigger.UpdateCallsonContactNameChange: line 12, column 1: []"].

I'm giving my Trigger and class to analyze:

trigger UpdateCallsonContactNameChange on Contact (after update) {
    if(updatePhysiciansNameonContactNameChange.RecursiveFlag)   
    {     
        updatePhysiciansNameonContactNameChange
           .changeName(Trigger.NewMap.keyset(),Trigger.new,Trigger.oldMap);        
    }
}

In the class the Physicianid and Fellowid__c are 2 lookup fields to the Contact.

Below is my class:

global 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 == con.id)
                    {                       
                        casrecord.Physicians__c = con.FirstName + ' ' + con.LastName;
                    }
                    else if(casrecord.Fellowid__c == con.id)
                    {
                        casrecord.Fellow__c = con.FirstName + ' ' + con.LastName;
                    }
                    
                    updateCalls.add(casrecord);           
                }
             }
        
        } 
        
        RecursiveFlag = false;
        update updateCalls;
  }
}
Source Link
user4613
  • 101
  • 1
  • 5

Getting Non Selective query issue

Hi All i'm getting an error message when i 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 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: []"].

Im giving my Trigger and class to annalyse

trigger UpdateCallsonContactNameChange on Contact (after update) {

 if(updatePhysiciansNameonContactNameChange.RecursiveFlag)   
{     
    updatePhysiciansNameonContactNameChange.changeName(Trigger.NewMap.keyset(),Trigger.new,Trigger.oldMap);   
     
    }

}

My class is: Physicianid and Fellowid__c are 2 lookup fields to the Contact.

global class updatePhysiciansonContactNameChange {

Public static Boolean RecursiveFlag = true; public static void changeName(Set ids,List 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==con.id)
          {                       
                casrecord.Physicians__c=con.FirstName+' '+con.LastName;
            }
            else if(casrecord.Fellowid__c==con.id)
            {
                   casrecord.Fellow__c=con.FirstName+' '+con.LastName;
             }
                   updateCalls.add(casrecord);           
           
          }

     }

} 
RecursiveFlag = false;
 update updateCalls;

} }