I'm trying to clone a row of an EmailMessage object to store the Created Date field with its original value. I am using the clone() Apex method https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_sobject.htm#apex_System_SObject_clone

I set IsDeepClone to true, if I analyze the code with debugs everything goes correctly, but at the time of the insert, it sets the created date to the value now and does not leave the original. What can I do to keep the created date without updating? I have checked on the internet, in some site it said that with the clone it was solved, but to me it continues changing to me

  • 2
    Have you enabled "Create Audit Fields" and given the permission to the user? These fields are normally read-only, so you need special permissions to even have a chance.
    – sfdcfox
    Commented Nov 17, 2022 at 16:16
  • Thank you very much, by doing that it has been solved. It is a feature that will be used by many users, is there any option to put that is valid for all and not for people included in the profile? If you want to put as thread answer, I mark it as the correct one. Again thank you very much.
    – Jota
    Commented Nov 17, 2022 at 16:55

1 Answer 1


You need to enable Create Audit Fields, and assign the permission to the user. You can assign the permission to many users by creating a Permission Set, and assigning all users that you want to the Permission Set.

You must log in to answer this question.

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