[SalesForce] Clone (Parent -> Child ) record with its related list using list button

I have a requirement to clone (Parent -> Child ) records by clicking a button at the Parent Level with its realted list. I believe Salesforce supports Clone at the Parent Level, it does not have Clone Out Of the Box. Has anyone ever built it ?

How should i do this

Best Answer

Yes you can do this by using apex method or cloning by using visual force page. Here is a link for triggering apex method with custom button.

For using visual force page from custom button follow this link.

Now in apex method you can clone an object with its child records as you have ID which if of master record. clone() method will clone your existing record. By using ID you can fetch child records then you can iterate through child records for cloning.

Follow this link.

Hope this will help.