2

Does anyone know if it's possible to delete AccountHistory data?

Bonus points: Is there an easy way to find the total number of AccountHistory records in an org?

1 Answer 1

3

AccountHistory is non-deletable. This is a system-wide property that cannot be changed. The only way to delete it is to remove the entire account (e.g. create a clone and remove the old one).

You can query the history data with SOQL, but it's likely to hit the governor limit of 50.000 if done in a normal situation. Therefore you need to use the API which has broader limits.

E.g. open the Developer Console, go to 'Query Editor' (at the bottom) and enter the query

Select Id From AccountHistory

At the top of your results, the total amount of records will be shown.

6
  • I keep getting No response from the server for some reason when I do this.
    – dphil
    Commented Jun 12, 2014 at 14:55
  • How many Accounts have you got in your org? Maybe the amount of data is just too much.. And (just to be sure) are you logged in as system administrator? Commented Jun 12, 2014 at 15:09
  • 263k accounts in our org. Yes I'm system admin. I guess there could just be too many records and it's just freaking out.
    – dphil
    Commented Jun 12, 2014 at 15:11
  • You could do a little execute anonymous of: List<AccountHistory> ah = [SELECT Id FROM AccountHistory]; System.debug(ah.size()); and that would tell you how many records you are potentially dealing with. Commented Jun 12, 2014 at 15:11
  • Hmm similar issue here: salesforce.stackexchange.com/questions/30302/cant-query-tasks Must be due to the amount of records, indeed. I am actually getting the same in my production org, whereas our full sandbox is fine. Commented Jun 12, 2014 at 15:16

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .