{"id":166,"date":"2013-01-10T02:34:14","date_gmt":"2013-01-09T21:34:14","guid":{"rendered":"http:\/\/learnsf.wordpress.com\/?p=166"},"modified":"2013-01-10T02:34:14","modified_gmt":"2013-01-09T21:34:14","slug":"how-to-clone-a-custom-object-in-salesforceeclipse","status":"publish","type":"post","link":"https:\/\/blog.felineflock.com\/index.php\/2013\/01\/10\/how-to-clone-a-custom-object-in-salesforceeclipse\/","title":{"rendered":"How to clone a custom object in Salesforce\/Eclipse"},"content":{"rendered":"<p>This is how you can create a new custom object with the same fields as an existing custom object:<\/p>\n<p><strong>1) Download custom objects in Eclipse<\/strong><\/p>\n<p>&#8211; right-click the project in the &#8216;Package Explorer&#8217; window<\/p>\n<p>&#8211; in the popup menu, select &#8216;Force.com\/Project Properties&#8217;<\/p>\n<p style=\"padding-left:60px;\"><a href=\"http:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image001.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-172\" alt=\"\" src=\"http:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image001.png\" width=\"596\" height=\"263\" srcset=\"https:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image001.png 596w, https:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image001-300x132.png 300w\" sizes=\"auto, (max-width: 596px) 100vw, 596px\" \/><\/a><\/p>\n<p>&#8211; in the properties window, select &#8216;Force.com\/Project Contents&#8217;<\/p>\n<p>&#8211; click &#8216;Add\/Remove&#8217;, then make sure that the &#8216;objects &#8211; custom component&#8217; is checked<\/p>\n<p style=\"padding-left:60px;\"><a href=\"http:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image002.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-174\" alt=\"\" src=\"http:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image002.png\" width=\"604\" height=\"190\" srcset=\"https:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image002.png 684w, https:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image002-300x95.png 300w\" sizes=\"auto, (max-width: 604px) 100vw, 604px\" \/><\/a><\/p>\n<p>&#8211; click &#8216;Apply&#8217; and respond Yes to the &#8216;Refresh Project From Server&#8217; dialog<\/p>\n<p style=\"padding-left:60px;\"><a href=\"http:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image005.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-173\" alt=\"\" src=\"http:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image005.png\" width=\"569\" height=\"593\" srcset=\"https:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image005.png 569w, https:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image005-288x300.png 288w\" sizes=\"auto, (max-width: 569px) 100vw, 569px\" \/><\/a><\/p>\n<p><strong>2) Create new object in Eclipse<\/strong><\/p>\n<p>&#8211; right-click the &#8216;objects&#8217; folder, then select &#8216;New\/Custom Object&#8217;<\/p>\n<p style=\"padding-left:60px;\"><a href=\"http:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image006.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-171\" alt=\"\" src=\"http:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image006.png\" width=\"532\" height=\"210\" srcset=\"https:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image006.png 532w, https:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image006-300x118.png 300w\" sizes=\"auto, (max-width: 532px) 100vw, 532px\" \/><\/a><\/p>\n<p>&#8211; give it a label, plural label and a name, then save it<\/p>\n<p><strong>3) Copy existing object fields to the Clipboard<\/strong><\/p>\n<p>&#8211; right-click the object, then select &#8216;Open With\/Text Editor&#8217;<\/p>\n<p style=\"padding-left:60px;\"><a href=\"http:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image007.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-170\" alt=\"\" src=\"http:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image007.png\" width=\"458\" height=\"195\" srcset=\"https:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image007.png 458w, https:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image007-300x128.png 300w\" sizes=\"auto, (max-width: 458px) 100vw, 458px\" \/><\/a><\/p>\n<p>&#8211; copy to the Clipboard the part from the first line of &lt;fields&gt; to the last line of &lt;\/fields&gt;<\/p>\n<p>&#8211; it is usually between &lt;enableReports&gt; and &lt;label&gt;<\/p>\n<p style=\"padding-left:60px;\"><a href=\"http:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image008.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-169\" alt=\"\" src=\"http:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image008.png\" width=\"458\" height=\"331\" srcset=\"https:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image008.png 458w, https:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image008-300x217.png 300w\" sizes=\"auto, (max-width: 458px) 100vw, 458px\" \/><\/a><\/p>\n<p><strong>4) Insert fields into the new object<\/strong><\/p>\n<p>&#8211; right-click the new object created in step 2, then select &#8216;Open With\/Text Editor&#8217;<\/p>\n<p>&#8211; locate the line with &lt;enableReports&gt; and paste the Clipboard contents right below it, before the &lt;label&gt; line<\/p>\n<p style=\"padding-left:60px;\"><a href=\"http:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image004.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-168\" alt=\"\" src=\"http:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image004.png\" width=\"466\" height=\"193\" srcset=\"https:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image004.png 466w, https:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image004-300x124.png 300w\" sizes=\"auto, (max-width: 466px) 100vw, 466px\" \/><\/a><\/p>\n<p><strong>5) Repeat steps 3 and 4 for any other needed configurations<\/strong><\/p>\n<p>&#8211; for example, you may need to copy the lines with the following tags: &lt;listViews&gt;, &lt;searchLayouts&gt;, &lt;validationRules&gt;, &lt;recordTypes&gt;<\/p>\n<p><strong>6) Save the new altered object<\/strong><\/p>\n<p>&#8211; look at the &#8216;Problems&#8217; tab at the bottom for any error messages, they will indicate what you need to change to make the object accepted<\/p>\n<p>&#8211; problems to look for: relationship names will need to be changed to be different from the existing object&#8217;s relationships ( &lt;relationshipLabel&gt; and  &lt;relationshipName&gt;)<\/p>\n<p>&#8211; focus on first renaming relationship names like below to avoid duplicates and the rest of the formulas should work thereafter (the errors xxx__r doesn\u2019t exist are because a relationship could not be created due to duplicate relationship names)<\/p>\n<p style=\"padding-left:60px;\"><a href=\"http:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image010.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-167\" alt=\"\" src=\"http:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image010.png\" width=\"604\" height=\"444\" srcset=\"https:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image010.png 670w, https:\/\/blog.felineflock.com\/wp-content\/uploads\/2013\/01\/image010-300x221.png 300w\" sizes=\"auto, (max-width: 604px) 100vw, 604px\" \/><\/a><\/p>\n<p>&#8211; after all errors are resolved, the object will be saved<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This is how you can create a new custom object with the same fields as an existing custom object: 1) Download custom objects in Eclipse &#8211; right-click the project in the &#8216;Package Explorer&#8217; window &#8211; in the popup menu, select &#8216;Force.com\/Project Properties&#8217; &#8211; in the properties window, select &#8216;Force.com\/Project Contents&#8217; &#8211; click &#8216;Add\/Remove&#8217;, then make [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"_uf_show_specific_survey":0,"_uf_disable_surveys":false,"footnotes":""},"categories":[13],"tags":[],"class_list":["post-166","post","type-post","status-publish","format-standard","hentry","category-no-category"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/blog.felineflock.com\/index.php\/wp-json\/wp\/v2\/posts\/166","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/blog.felineflock.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/blog.felineflock.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/blog.felineflock.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/blog.felineflock.com\/index.php\/wp-json\/wp\/v2\/comments?post=166"}],"version-history":[{"count":0,"href":"https:\/\/blog.felineflock.com\/index.php\/wp-json\/wp\/v2\/posts\/166\/revisions"}],"wp:attachment":[{"href":"https:\/\/blog.felineflock.com\/index.php\/wp-json\/wp\/v2\/media?parent=166"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/blog.felineflock.com\/index.php\/wp-json\/wp\/v2\/categories?post=166"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/blog.felineflock.com\/index.php\/wp-json\/wp\/v2\/tags?post=166"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}