function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Anas AlamourAnas Alamour 

Clone Record using Apex

I have lookup parent-child releationship, i need to write apex code to clone record of the child object and link this a colned record to record of the parent objetct, anyone can help me to write this code as Anonymous Apex Code in developer consol. Thank you. 
AbhishekAbhishek (Salesforce Developers) 
Anas,

To Clone parent records along with child records Please refer the below link for reference.

>>https://salesforce.stackexchange.com/questions/8493/deep-clone-parent-child-grand-child

>>http://www.infallibletechie.com/2013/06/how-clone-record-with-related-records.html



For further reference,
https://salesforce.stackexchange.com/questions/158404/cloning-a-record-and-its-children


If it helps you and close your query by marking it as solved so that it can help others in the future.

Thanks.