1

Given the below Account field:

foo__c Text(255) (External ID) (Unique Case Insensitive)

If we use the following in Apex code, does a value in the foo__c field get copied over to the newly cloned record?

Account clonedAcct = originalAcct.clone(false, true, false, false);

If so, this would imply one would be unable to insert a cloned record unless the values of non-null unique fields are cleared before inserting the newly cloned Account.

https://developer.salesforce.com/docs/atlas.en-us.apexref.meta/apexref/apex_methods_system_sobject.htm#apex_System_SObject_clone

1 Answer 1

4

Yes, values in all fields are copied over, except those you can configure not to. The only fields you can configure, however, are the Id, any read-only timestamps, and autonumber fields.

You must log in to answer this question.

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