1

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

1

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.

  • but vivek i used custom list button in particular object – Ravi Vadher Aug 18 '15 at 8:04
  • simply just i made button in page layout and then clicked that button clone record of entire record with its related list how should i do this? – Ravi Vadher Aug 18 '15 at 8:09
  • Same thing. In that case you have list of IDs. Get records by these Ids and clone them, then get child records by using master objects IDs clone them too. – Vivek Malpani Aug 18 '15 at 9:12
1

You could do something like this via Flow. You could grab the parent and child records, and then duplicate/clone them manually inside your Flow.

Just pass the (parent) ID into the Flow --> grab the child records for records with parent ID = to the ID passed in. And now create the cloned records.

Depending on how many records you plan on having... if you plan to hit over 20~ records then you might want to not use a standard Record Create because you'll potentially loop through more than the allotted 50 lookup/creates that you get in your Flow. In that case, you would want to use a Fast Lookup/Create and use the assignments to setup it correctly.

1

I made a free appExchange app that clones Parent -> Child. Setup a custom button that references the parent record id and a configuration name. You can specify which child relationships that you want to copy. Super Clone

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.