I'm getting exception in following query,
List<Background_Search__c> lstbgs = [SELECT id FROM Background_Search__c WHERE AIT_Selected_for_Random_Search_Audit__c = true AND CreatedDate>2014-12-04T00:00:00.000Z ORDER BY id DESC LIMIT 1];
Salesforce Stack Exchange is a question and answer site for Salesforce administrators, implementation experts, developers and anybody in-between. It only takes a minute to sign up.Sign up to join this community
You attempt to query big collection and too many records are potential match. Your query in Salesforce need to be as selective as possible - this mean return only records that match your criteria and it should use field mark as "indexed"(Id, externalId etc).