+ Start a Discussion

Activity History has a limit of 199 records that can be queried!?

I'm running apex queries against an account to retrieve its related activity history records. However that account has alot of history and as a result i'm running into the error "unexpected exception activity history cannot be queried" somewhere after it recieves over 200 records. When i limit this query to less than 200, 199 for instance, that error goes away.


Is this a bug? I cannot find any official documentation on this limit.


Here is the query:


for(Account account : [Select Id, (Select Id, Description From ActivityHistories limit 199) From Account Where Id = 'some id'])
  for(ActivityHistory histories : account.ActivityHistories)


This is not ok as i need all of the activity histories returned. I cannot run additional queries based off of the exception either as it is not possible to catch an 'unexcepted exception'. Anyone have any ideas on how to retrieve all of the activity histories for accounts that would have over 200?

pradeep prakashpradeep prakash
try removing description field in the query.