Clone SObject Relationships

Why would going one by one mean running out of queries? You could grab them all, clone them into a list and update the list in groups of 200.

If doing that is still likely to present problems then I think the best way forward is for you to write a class implementing the Batchable interface, they're designed explicitly to do heavy data lifting like this!


I may not understand the questions, but I wrote a blog post a while ago about cloning records. See http://sfdc.arrowpointe.com/2011/03/28/cloning-records-in-apex/. It may help. It basically has a method that will build you a SOQL query that contains all the writable fields. You'd need to make that query and then do a .clone() on the sObject in Apex and then make whatever changes you need, then insert it.


The free Astrea Clone app only works with Standard Objects.

There is another App called Object Converter which can be used to clone Parent & Children for both standard and custom objects

Tags:

Clone

Soql

Apex