[SalesForce] the quickest way to clone a custom object and make it a child\detail to another custom object

I am trying to essentially re-create a custom object and then make the new copy a child to the original object. What is the quickest way to do this ? I have looked into it on App Exchange but it appears that all of the cloning apps I've seen (iClone ; Astrea Clone) are really just about cloning records in order to maintain their related lists and such. I'm not trying to clone any records. I'm just trying to avoid re-creating the actual object from scratch.

Thank you very much for your help.

Best Answer

You can try this, but your milage may vary:

  1. Get Apache Ant and the Migration Tool.
  2. Create a package.xml file that retrieves your custom object.
  3. Retrieve your custom object.
  4. Rename the file in src/objects that is the current object.
  5. Modify the file itself to reflect the new name, label, etc.
  6. Modify src/package.xml to reflect the new custom object.
  7. Deploy this new object; all fields will be cloned and the entire object created.
  8. Create the master-detail relationship, tab, etc, using the UI.

This technique is effective when the custom object has more than about 20 fields or so, from a time-consumption perspective.