You need to sign in to do that
Don't have an account?
Frank Jordan 14
System.QueryException: Non-selective query against large object type (more than 100000 rows) Help?
I have a trigger that updates a check box on a task when it is the most recent task created by the account owner. I am getting the following error: System.QueryException: Non-selective query against large object type (more than 100000 rows). I even added a condition in my query where the created date must be after May of this year, and i know for a fact that there arent more than 100,000 rows. Any idea?
trigger LastActivityByAccountOwner on Task (after insert, after update) { List<Task> TasksToUpdate = new List<Task>{}; boolean firstRecord = true; for(Task ttu : [Select Id, Last_activity_by_account_owner__c , Same_as_Account_Owner__c from Task where Same_as_Account_Owner__c = true AND DAY_ONLY(createddate)>2016-05-01 ORDER BY createddate DESC ]) { if(firstRecord) { ttu.Last_activity_by_account_owner__c = True; firstRecord = false; } else ttu.Last_activity_by_account_owner__c = False; TasksToUpdate.add(ttu); } }
Let me know if that does not work