{"id":646,"date":"2020-04-26T19:45:56","date_gmt":"2020-04-26T19:45:56","guid":{"rendered":"http:\/\/markedcode.com\/?p=646"},"modified":"2025-04-07T11:49:55","modified_gmt":"2025-04-07T11:49:55","slug":"copying-a-record-in-dynamics-365","status":"publish","type":"post","link":"https:\/\/markedcode.com\/index.php\/2020\/04\/26\/copying-a-record-in-dynamics-365\/","title":{"rendered":"Copying a record in Dynamics 365"},"content":{"rendered":"\n<p><h2><strong>Copying a record in Dynamics 365<\/strong><\/h2>\n<p>Copying a record in Dynamics 365 can be easily done two different ways using x++. Those are buf2buf and data.<br>I am going to show you how to use each and what the differences are between the two.<\/p><\/p>\n\n\n\n<p><strong>Data<\/strong>: Here is an example of how to copy a record using data.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-647\" src=\"https:\/\/markedcode.com\/wp-content\/uploads\/2020\/04\/DataCopy.png\" alt=\"Copying a record in Dynamics 365 with data\" width=\"676\" height=\"515\" srcset=\"https:\/\/markedcode.com\/wp-content\/uploads\/2020\/04\/DataCopy.png 676w, https:\/\/markedcode.com\/wp-content\/uploads\/2020\/04\/DataCopy-300x229.png 300w\" sizes=\"auto, (max-width: 676px) 100vw, 676px\" \/><\/figure>\n\n\n\n<p>When copying a record with data we can see that the system fields are copied over as well. This includes fields like RecId, and DataAreaId.<br>Most of the time this is not an issue as the system fields are overridden when the record gets saved.<br>However there can be some issues when copying records between companies.<\/p>\n\n\n\n<p><strong>Buf2buf<\/strong>: Here is an example of how to copy a record using buf2buf.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-648\" src=\"https:\/\/markedcode.com\/wp-content\/uploads\/2020\/04\/bu2bufCopy.png\" alt=\"Copying a record in Dynamics 365 with buf2Buf\" width=\"637\" height=\"555\" srcset=\"https:\/\/markedcode.com\/wp-content\/uploads\/2020\/04\/bu2bufCopy.png 637w, https:\/\/markedcode.com\/wp-content\/uploads\/2020\/04\/bu2bufCopy-300x261.png 300w\" sizes=\"auto, (max-width: 637px) 100vw, 637px\" \/><\/figure>\n\n\n\n<p>Using buf2Buf does NOT copy over system fields but still copies over all of the data fields from the original record.<br>This is a safer way to copy records when crossing legal entities in Dynamics 365.<br>By right clicking on buf2Buf and going to the code we can see how the method ignores the base system fields when copying the record.<\/p>\n\n\n\n<figure class=\"wp-block-image size-large\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone wp-image-649\" src=\"https:\/\/markedcode.com\/wp-content\/uploads\/2020\/04\/buf2bufFunction.png\" alt=\"buf2Buf source code\" width=\"656\" height=\"359\" srcset=\"https:\/\/markedcode.com\/wp-content\/uploads\/2020\/04\/buf2bufFunction.png 656w, https:\/\/markedcode.com\/wp-content\/uploads\/2020\/04\/buf2bufFunction-300x164.png 300w\" sizes=\"auto, (max-width: 656px) 100vw, 656px\" \/><\/figure>\n\n\n\n<p><p>Copying a record in Dynamics 365 can be really easy as long as you know when to use which method! <a href=\"https:\/\/docs.microsoft.com\/en-us\/dynamicsax-2012\/developer\/methods-in-x\">Check out more common X++ methods!<\/a><\/p> <p><a href=\"https:\/\/markedcode.com\/index.php\/2020\/04\/17\/color-coding-records-in-d365\/\">Read another developer tips and tricks article for Dynamics 365!<\/a><\/p><\/p>\n\n\n\n<p>For technical questions, please visit <a href=\"https:\/\/d365techsupport.com\">https:\/\/d365techsupport.com<\/a><\/p>\n","protected":false},"excerpt":{"rendered":"<p>Copying a record in Dynamics 365 Copying a record in Dynamics 365 can be easily done two different ways using x++. Those are buf2buf and data.I am going to show you how to use each and what the differences are between the two. Data: Here is an example of how to copy a record using<\/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,"footnotes":""},"categories":[7,9],"tags":[18,50],"class_list":{"0":"post-646","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-d365","7":"category-tips-and-tricks","8":"tag-copying-a-record-in-dynamics-365-for-finance-and-operations-x-code-table-buffer-system-fields","9":"tag-x"},"_links":{"self":[{"href":"https:\/\/markedcode.com\/index.php\/wp-json\/wp\/v2\/posts\/646","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/markedcode.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/markedcode.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/markedcode.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/markedcode.com\/index.php\/wp-json\/wp\/v2\/comments?post=646"}],"version-history":[{"count":3,"href":"https:\/\/markedcode.com\/index.php\/wp-json\/wp\/v2\/posts\/646\/revisions"}],"predecessor-version":[{"id":1334,"href":"https:\/\/markedcode.com\/index.php\/wp-json\/wp\/v2\/posts\/646\/revisions\/1334"}],"wp:attachment":[{"href":"https:\/\/markedcode.com\/index.php\/wp-json\/wp\/v2\/media?parent=646"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/markedcode.com\/index.php\/wp-json\/wp\/v2\/categories?post=646"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/markedcode.com\/index.php\/wp-json\/wp\/v2\/tags?post=646"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}