I am trying to get the uncompleted tasks of every lead in a Lead View, when I try to get all the tasks it works fine, but when I add in the "where Status != 'Completed'" I get the following exception:
core.apexpages.exceptions.ApexPagesHandledException: Object type not accessible. Please check permissions and make sure the object is not in development mode: Status != 'Completed') from Lead AND ((IsConverted = FALSE)) AND ^ ERROR at Row:1:Column:87 unexpected token: AND
the code I am using to do this is:
//works Database.QueryLocator ql = Database.getQueryLocator('select Id, (select Id, ActivityDate from Tasks') from Lead limit 1'); //doesnt work Database.QueryLocator ql = Database.getQueryLocator('select Id, (select Id, ActivityDate from Tasks where Status != \'Completed\') from Lead limit 1'); ApexPages.StandardSetController setController = new ApexPages.StandardSetController(ql); setController.setFilterID('00Bi0000006BgwZ'); List<Lead> filtered = setController.getRecords(); What does the error mean? Is there something I can do to configure my salesforce account so this will work? or do I just need to change the query?
If it matters I am currently running this code from the developer console
where Status != CompletedANDkeyword incorrect. But can't see it in your code. Can you verify this?