+ Start a Discussion
satishch_sfdcsatishch_sfdc 

Need clarification about parameters of the deepclone method

Hi,this is satish

I have used deepclone method in my apex class for my requirement. But I got few doubts while using this method.Here is the signature of the method

public List<Object> deepClone(Boolean opt_preserve_id, Boolean opt_preserve_readonly_timestamps, Boolean opt_preserve_autonumber)

But if i make the first parameter true, As per the signature the original record id will be copied to duplicate.

  eg: Mylist.deepclone(true);
My first question is how the two records will have same ID in same object?

One more thing if i make second parameter is true the readonly timestamp is copied to the duplicate record.

   eg: Mylist.deepclone(false,true);

I tried this but i did n't get the original record Createddate, CreatedID ot LatmodifiedID, Lastmodifieddate to the copied record.

can any one please carify this, Thanks in advance.

Thanks,
Satish


 
Balaji BondarBalaji Bondar
Hi Satish,

Createddate, CreatedID ot LatmodifiedID, Lastmodifieddate are the system fields and will be generated by Salesforce.com and these will be read only.In both of the cases you discussed for deep clone, the values will be determined by Salesforce.com at the time of record creation.

Important :
If this is what you were looking for then please mark it as a "SOLUTION" or You can Click on the "Like" Button if this was beneficial for you.