2

Looking into the .clone() method, is it possible at all to clone the record history of a record?

Say I have an account which I wish to clone, is it possible to clone this account entirely and also all the line entries in its underlying account history?

I assume not, as when one tries to edit the activity object of a record, a 'Locked' error is thrown.

Thanks, Andy

3

I do not think Salesforce allows this, since the record history would not be useful as an auditable history if you could modify it.

AccountHistory only supports the following calls:

describeSObjects() getDeleted() getUpdated() query() retrieve()

Source:

https://developer.salesforce.com/docs/atlas.en-us.api.meta/api/sforce_api_objects_accounthistory.htm?search_text=history

1

The record history is stored in a different table (AccountHistory), and is not writeable either in Apex or using the Dataloader.

You could create a new custom object to store history data and associate to the new Accounts.

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.