2

Ok, we are sort of running out of space on one instance, and we noticed that EmailMessage-s and their accompanying Tasks take about 60% of our instance (we use a lot of Email2Case here). So the idea is to just offload old emails in closed cases to an external CSV and just remove it from instance. Since these are old completed tasks, the SF moved them from Tasks to ActivityHistory.

Problems is that ActivityHistory does not exist in the Export object list, neither in web interface nor in Data Loader utility. So how do I go about extracting that data (and subsequently deleting it from the said object).

I read this post (Trying To Export Activity History Object), however that doesn't seem to help, when I query Tasks for legacy entries, it returns zero rows, so the answer seems to be inaccurate.

Any ideas?

2

Think about Activity History as just a related list with a pointer to completed tasks. The records in that object cannot be created, edited, deleted, etc because they, in essence, do not exist.

The records are actually just Tasks in a completed status.

This query will pull all completed tasks. Exporting and deleting them will remove them from the history:

Select Subject, Status From Task Where Status = 'Completed'

Or more specifically use isClosed

Select Subject, Status From Task Where isClosed = true
  • so, its a virtual table based on the completed status? weird. Anyway, it seems to be working because I now get "your query is running too long" error from Data Loader. For an enterprise level platform, they sure are picky. This is going to be a long day... – mmix Aug 10 '16 at 12:33
  • Actually,this has not solved the problem. When I put select ... from Tasks where CreatedDate < 2016-01-01T00:00:00Z and IsClosed = true I only get 20k rows for the closed tasks that are less than a year old. There are no entries older than a year. I should be getting around 300k rows if the entire history is taken. – mmix Aug 10 '16 at 13:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.