{"id":1648,"date":"2018-11-27T10:02:49","date_gmt":"2018-11-27T16:02:49","guid":{"rendered":"https:\/\/www.teamdesk.net\/blog\/?p=1648"},"modified":"2021-09-28T04:59:13","modified_gmt":"2021-09-28T09:59:13","slug":"copy-master-record-into-separate-table-with-related-details","status":"publish","type":"post","link":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/copy-master-record-into-separate-table-with-related-details\/","title":{"rendered":"Copy Master record into a separate table and generate copies of related Details"},"content":{"rendered":"<p>The most typical case when you need to copy master record into a separate table and copy its related details is the Invoice record generation based on the previously created Order record.<br \/>\nFor example, you keep customer orders in the Orders table. Moreover, each Order includes Order Items related to it. So, you have the Order master record that is related to many Order Items (detail records). In the terms of online database there is the <a href=\"https:\/\/www.teamdesk.net\/help\/8.1.aspx\">One-to-Many relation<\/a> between the Orders table and the Order Items table.<br \/>\nWhen the order is agreed, a user needs to generate the Invoice record related to this Order. Let\u2019s assume that the relation is One Order-One Invoice.<br \/>\nFurthermore, all Order Items related to the Order should be copied into the separate Invoice Items table. Moreover, these copies should be related to the newly created Invoice automatically.<br \/>\nSo, in this blog post we describe how to add a <a href=\"https:\/\/www.teamdesk.net\/help\/11.1.aspx\">custom button<\/a> to the Order record allowing to generate a master record copy (Invoice) in a separate table with copies of related details (Invoice Items).<\/p>\n<p><a href=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Generate-Master-Copy-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1652\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Generate-Master-Copy-1.png\" alt=\"Master record copy\" width=\"939\" height=\"632\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Generate-Master-Copy-1.png 939w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Generate-Master-Copy-1-300x202.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Generate-Master-Copy-1-768x517.png 768w\" sizes=\"auto, (max-width: 939px) 100vw, 939px\" \/><\/a><\/p>\n<h2>1. The Invoice ID values can be generated in the Orders table<\/h2>\n<p>To simplify the adjustment we recommend to create the \u201cInvoice ID Text (auxiliary)\u201d column of the <a href=\"https:\/\/www.teamdesk.net\/help\/4.6.2.aspx\">text type<\/a> in the Orders table. The task for this column is to generate the Invoice ID values automatically. Therefore there is the <a href=\"https:\/\/www.teamdesk.net\/help\/4.7.aspx\">Default\/Calculate formula<\/a> in the column settings.<\/p>\n<p><a href=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Invoice-ID-Default-Calculate-2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1653\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Invoice-ID-Default-Calculate-2.png\" alt=\"Invoice ID\" width=\"993\" height=\"708\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Invoice-ID-Default-Calculate-2.png 993w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Invoice-ID-Default-Calculate-2-300x214.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Invoice-ID-Default-Calculate-2-768x548.png 768w\" sizes=\"auto, (max-width: 993px) 100vw, 993px\" \/><\/a><\/p>\n<p>As a result, the Invoice ID value can be generated automatically. Besides, it is based on the Order ID value. By the way, you can use any other <a href=\"https:\/\/www.teamdesk.net\/help\/13.3.aspx\">formula<\/a> that meets your needs.<\/p>\n<h2>2. Invoice ID lookup<\/h2>\n<p>Now you should make some adjustment in the Order Items table. As you remember, there is <a href=\"https:\/\/www.teamdesk.net\/help\/8.1.aspx\">One-to-Many relation<\/a> between Order and Order Items. The first step is to add a <a href=\"https:\/\/www.teamdesk.net\/help\/4.4.aspx\">lookup column<\/a> to the Order Items table. This lookup column should refer to the \u201cInvoice ID Text (auxiliary)\u201d column kept in the Orders table. Let\u2019s name it \u201cInvoice ID Lookup (auxiliary)\u201d.<\/p>\n<p><a href=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Lookup-Auxiliary-2.2.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1655\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Lookup-Auxiliary-2.2.png\" alt=\"Invoice ID lookup\" width=\"992\" height=\"360\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Lookup-Auxiliary-2.2.png 992w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Lookup-Auxiliary-2.2-300x109.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Lookup-Auxiliary-2.2-768x279.png 768w\" sizes=\"auto, (max-width: 992px) 100vw, 992px\" \/><\/a><\/p>\n<p>In the following adjustment this lookup column will help to relate newly generated details to the Invoice master record.<\/p>\n<h2>3. Record Id formula-column<\/h2>\n<p>The second step is to define the Order Item record Id value assigned by the system and keep this Id in a separate column. Therefore you need to create the \u201cOrder Item Record Id (auxiliary)\u201d <a href=\"https:\/\/www.teamdesk.net\/help\/4.6.16.aspx\">formula-text<\/a> column comprising this formula: RecordId()<\/p>\n<p><a href=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/RecordId-Formula-3-1.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1656\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/RecordId-Formula-3-1.png\" alt=\"Record Formula\" width=\"873\" height=\"459\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/RecordId-Formula-3-1.png 873w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/RecordId-Formula-3-1-300x158.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/RecordId-Formula-3-1-768x404.png 768w\" sizes=\"auto, (max-width: 873px) 100vw, 873px\" \/><\/a><\/p>\n<p>You can remove this&nbsp;formula-text column from the data entry form and don\u2019t display in views.<\/p>\n<h2>4. Auxiliary Summary column in the Orders table.<\/h2>\n<p>According to our example One Order can be related to many Order Items. So, the next step is to list the system ID values of details records (Order Items) in the \u201cOrder\u201d master record. Hence, you should add the <a href=\"https:\/\/www.teamdesk.net\/help\/4.5.aspx\">summary column<\/a> of the concatenate type to the relation. Let\u2019s name this summary column \u201cRelated OrderItems RecordID (auxiliary)\u201d. You may review the column settings on the screenshot below:<\/p>\n<p><a href=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Summary-Column-4.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1657\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Summary-Column-4.png\" alt=\"Record ID Details Summary\" width=\"1094\" height=\"635\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Summary-Column-4.png 1094w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Summary-Column-4-300x174.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Summary-Column-4-768x446.png 768w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Summary-Column-4-1024x594.png 1024w\" sizes=\"auto, (max-width: 1094px) 100vw, 1094px\" \/><\/a><\/p>\n<p>As the result, you can see the system record ID values of the related Items in each Order record.<\/p>\n<p><a href=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Related-Items-List-5.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1658\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Related-Items-List-5.png\" alt=\"Related Items ids\" width=\"1084\" height=\"448\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Related-Items-List-5.png 1084w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Related-Items-List-5-300x124.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Related-Items-List-5-768x317.png 768w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Related-Items-List-5-1024x423.png 1024w\" sizes=\"auto, (max-width: 1084px) 100vw, 1084px\" \/><\/a><\/p>\n<h2>5. Auxiliary Lookup Column in the Invoices table<\/h2>\n<p>In our database example each invoice should be related to one order only and vice versa. To adjust this relation, create the \u201cOrder\u201d <a href=\"https:\/\/www.teamdesk.net\/help\/4.3.aspx\">single-reference column<\/a> in the Invoices table. Using this relation, you can add <a href=\"https:\/\/www.teamdesk.net\/help\/4.4.aspx\">lookup columns<\/a> to the Invoices table. Currently, to generate copies of related details, you need an auxiliary lookup column in the Invoices table. This lookup should refer to the previously described \u201cRelated OrderItems RecordID (auxiliary)\u201d summary column.<br \/>\nOn this screenshot the lookup column settings are shown:<\/p>\n<p><a href=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Lookup-to-the-Summary-52.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1659\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Lookup-to-the-Summary-52.png\" alt=\"Lookup To Sumary\" width=\"1091\" height=\"533\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Lookup-to-the-Summary-52.png 1091w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Lookup-to-the-Summary-52-300x147.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Lookup-to-the-Summary-52-768x375.png 768w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Lookup-to-the-Summary-52-1024x500.png 1024w\" sizes=\"auto, (max-width: 1091px) 100vw, 1091px\" \/><\/a><\/p>\n<p>When the lookup is adjusted, you can save the changes.<\/p>\n<h2>6. Multi-Record custom button.<\/h2>\n<p>Let\u2019s return to the \u201cOrder Items\u201d table again. Now you need to adjust the \u201cCopy Details (auxiliary)\u201d <a href=\"https:\/\/www.teamdesk.net\/help\/11.1.3.aspx\">multi-record custom button<\/a> with the \u201cNew Record Create\u201d action. This button will generate the copies of related details in the \u201cInvoice Items\u201d table. The button settings are displayed below:<\/p>\n<p><a href=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Multi-Button-7.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1660\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Multi-Button-7.png\" alt=\"Copy Details Auxiliary button\" width=\"937\" height=\"731\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Multi-Button-7.png 937w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Multi-Button-7-300x234.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Multi-Button-7-768x599.png 768w\" sizes=\"auto, (max-width: 937px) 100vw, 937px\" \/><\/a><\/p>\n<p>Also, the \u201cNew Record Create\u201d action has to comprise the following <a href=\"https:\/\/www.teamdesk.net\/help\/11.1.4.aspx\">assignments<\/a>:<\/p>\n<p><a href=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Assignments-8.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1661\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Assignments-8.png\" alt=\"Assignments\" width=\"799\" height=\"612\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Assignments-8.png 799w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Assignments-8-300x230.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Assignments-8-768x588.png 768w\" sizes=\"auto, (max-width: 799px) 100vw, 799px\" \/><\/a><\/p>\n<p>Moreover, one of the button assignments should assign \u201cInvoice ID Lookup (auxiliary)\u201d column values to the Invoice single-reference column created in the \u201cInvoice Items\u201d table. This assignment will help to related newly generated Invoice Items with Invoice master record.<\/p>\n<h2>7. \u201cCreate Invoice\u201d button<\/h2>\n<p>Now you can add the \u201cCreate Invoice\u201d custom button to the Orders table. This button can be placed on the Oder form. When a user clicks on the button, an Invoice master record is generated in the Invoices table. Besides, the data kept in the initial Order record can be copied to the newly created Invoice. Therefore the \u201cCreate Invoice\u201d <a href=\"https:\/\/www.teamdesk.net\/help\/11.1.5.aspx\">button<\/a> has to comprise the \u201cCreate Invoice Navigate Action\u201d of the <a href=\"https:\/\/www.teamdesk.net\/help\/11.4.7.aspx\">Navigate type<\/a> with the assignments.<br \/>\nYou may review the button settings on this screenshot:<\/p>\n<p><a href=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Create-Invoice-Button-9.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1662\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Create-Invoice-Button-9.png\" alt=\"Create Invoice Button\" width=\"936\" height=\"700\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Create-Invoice-Button-9.png 936w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Create-Invoice-Button-9-300x224.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Create-Invoice-Button-9-768x574.png 768w\" sizes=\"auto, (max-width: 936px) 100vw, 936px\" \/><\/a><\/p>\n<p>Also, you can see the navigate action settings below:<\/p>\n<p><a href=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Navigate-Action-Button-10.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1663\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Navigate-Action-Button-10.png\" alt=\"Navigate Action\" width=\"929\" height=\"684\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Navigate-Action-Button-10.png 929w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Navigate-Action-Button-10-300x221.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Navigate-Action-Button-10-768x565.png 768w\" sizes=\"auto, (max-width: 929px) 100vw, 929px\" \/><\/a><\/p>\n<p>Please note, that one of the assignments should assign the \u201cInvoice ID Text (auxiliary)\u201d column values into the \u201cInvoice ID\u201d key column. As a result, these copied values will allow to relate Invoice master record to the generated Invoice Item details.<br \/>\nMoreover, you can add the assignment ([Order ID] to [Order]) that will assign \u201cOrder ID\u201d key column values to the \u201cOrder\u201d single-reference column kept in the Invoices table.<\/p>\n<h2>8. Record Change Trigger with Navigate Action<\/h2>\n<p>The last step is to generate Invoice Items related details when an Invoice master record is created. Furthermore, every Invoice Item should include values of correspondent Order Item record.<br \/>\nTo automate the Invoice Items details generation, in the Invoices table you should create the <a href=\"https:\/\/www.teamdesk.net\/help\/11.3.1.aspx\">Record Change Trigger<\/a> with <a href=\"https:\/\/www.teamdesk.net\/help\/11.4.7.aspx\">Navigate<\/a> action. The main task of this trigger is to activate the \u201cCopy Details (auxiliary)\u201d multi-record custom button kept in the Order Items table.<br \/>\nSo, firstly, add the record change trigger to the Invoices table.<\/p>\n<p><a href=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Record-Change-trigger-11.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1664\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Record-Change-trigger-11.png\" alt=\"Record Change Trigger\" width=\"933\" height=\"693\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Record-Change-trigger-11.png 933w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Record-Change-trigger-11-300x223.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Record-Change-trigger-11-768x570.png 768w\" sizes=\"auto, (max-width: 933px) 100vw, 933px\" \/><\/a><\/p>\n<h2>9. Custom URL used in the Action<\/h2>\n<p>In the trigger you should adjust the navigate action of the Custom URL type, for example,&nbsp; this action:<\/p>\n<p><a href=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/New-Navigate-Action-12.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1665\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/New-Navigate-Action-12.png\" alt=\"Navigate Action 2\" width=\"931\" height=\"500\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/New-Navigate-Action-12.png 931w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/New-Navigate-Action-12-300x161.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/New-Navigate-Action-12-768x412.png 768w\" sizes=\"auto, (max-width: 931px) 100vw, 931px\" \/><\/a><\/p>\n<p>So, you can see the following URL used in the action: &lt;%URLRoot()%&gt;\/multi.aspx?b=233706&amp;p=&amp;ids=&lt;%=[Related OrderItems Record ID Lookup (auxiliary)]%&gt;&amp;ReturnUrl=&lt;%URLRoot() &amp; &#8220;\/preview.aspx?t=&#8221; &amp; TableId()&amp; &#8220;&amp;id=&#8221; &amp; RecordId() &amp; &#8220;&amp;back=&#8221; &amp; BackURL()%&gt;<br \/>\nYou can copy this URL, but you have to change these two elements:<\/p>\n<table border=\"1\">\n<tbody>\n<tr>\n<th>Element<\/th>\n<th>Description<\/th>\n<\/tr>\n<tr>\n<td>233706<br \/>\nID number of the Multi-Record button<\/td>\n<td>The ID number of the \u201cCopy Details (auxiliary)\u201d multi-record button created in the \u201cOrder Items\u201d table. This ID number is assigned by the system and can be copied from the button URL . Please note, that in your online database the button ID number will be different.<\/td>\n<\/tr>\n<tr>\n<td>[Related OrderItems Record ID Lookup (auxiliary)]<\/td>\n<td>The creation of this lookup is described in paragraph \u201c5. Auxiliary Lookup column in Invoices table\u201d of this article. Please note, that the name of the lookup created in your online database can be different.<\/td>\n<\/tr>\n<\/tbody>\n<\/table>\n<p>To find and copy the ID number of the \u201cCopy Details (auxiliary)\u201d multi-record button, you should do these steps:<br \/>\nFirstly, go to the Setup and select the \u201cOrder Items\u201d table. Secondly, choose Rules&gt;&gt;Custom Buttons. Finally, click on the button name:<\/p>\n<p><a href=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Button-form-13.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1666\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Button-form-13.png\" alt=\"Button\" width=\"969\" height=\"344\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Button-form-13.png 969w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Button-form-13-300x107.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Button-form-13-768x273.png 768w\" sizes=\"auto, (max-width: 969px) 100vw, 969px\" \/><\/a><\/p>\n<p>As a result, you can see the opened button form on the screen and the button URL in the address bar of a browser. You should copy the custom button ID number from the button URL:<\/p>\n<p><a href=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Button-URL-14.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1667\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Button-URL-14.png\" alt=\"Button URL\" width=\"1013\" height=\"49\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Button-URL-14.png 1013w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Button-URL-14-300x15.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Button-URL-14-768x37.png 768w\" sizes=\"auto, (max-width: 1013px) 100vw, 1013px\" \/><\/a><\/p>\n<p>When the action URL is adjusted and the \u201cNew Navigate\u201d action is saved, the trigger can activate the \u201cCopy Details (auxiliary)\u201d button for the related details copying.<br \/>\nThe adjustment is finished. Now a user can click on the \u201cCreate Invoice\u201d button displayed on the Order form and the system will create a new Invoice with generated copies of related details.<\/p>\n<p><a href=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Generate-Master-Copy-15.png\"><img loading=\"lazy\" decoding=\"async\" class=\"alignnone size-full wp-image-1668\" src=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Generate-Master-Copy-15.png\" alt=\"Copy Master Record\" width=\"939\" height=\"632\" srcset=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Generate-Master-Copy-15.png 939w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Generate-Master-Copy-15-300x202.png 300w, https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Generate-Master-Copy-15-768x517.png 768w\" sizes=\"auto, (max-width: 939px) 100vw, 939px\" \/><\/a><\/p>\n<p>In conclusion, you can <a href=\"https:\/\/www.teamdesk.net\/help\/4.12.aspx\">remove<\/a> all auxiliary columns from the data entry forms and don\u2019t display them in views. As a result, these columns will be invisible for users.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Here you may find the example how to copy master record into a separate table and copy its related details.<\/p>\n","protected":false},"author":3,"featured_media":1683,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[2],"tags":[156,155,127,152,45,157],"class_list":["post-1648","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-tips-tricks","tag-copy-master-details","tag-master-record","tag-online-database","tag-related-details","tag-relation","tag-relational-database"],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.4 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>Copy Master record into a separate table and generate copies of related Details - TeamDesk Blog<\/title>\n<meta name=\"description\" content=\"This example shows how to create a custom button to generate Invoice records from existing Orders and copy order Items as related details.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/copy-master-record-into-separate-table-with-related-details\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"Copy Master record into a separate table and generate copies of related Details - TeamDesk Blog\" \/>\n<meta property=\"og:description\" content=\"This example shows how to create a custom button to generate Invoice records from existing Orders and copy order Items as related details.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/copy-master-record-into-separate-table-with-related-details\/\" \/>\n<meta property=\"og:site_name\" content=\"TeamDesk Blog\" \/>\n<meta property=\"article:published_time\" content=\"2018-11-27T16:02:49+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2021-09-28T09:59:13+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Coipy-Master-Details-Title.png\" \/>\n\t<meta property=\"og:image:width\" content=\"971\" \/>\n\t<meta property=\"og:image:height\" content=\"575\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/png\" \/>\n<meta name=\"author\" content=\"Mila\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Mila\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"9 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/copy-master-record-into-separate-table-with-related-details\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/copy-master-record-into-separate-table-with-related-details\\\/\"},\"author\":{\"name\":\"Mila\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/#\\\/schema\\\/person\\\/63bd8646f2f4720f503116e38a190a6e\"},\"headline\":\"Copy Master record into a separate table and generate copies of related Details\",\"datePublished\":\"2018-11-27T16:02:49+00:00\",\"dateModified\":\"2021-09-28T09:59:13+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/copy-master-record-into-separate-table-with-related-details\\\/\"},\"wordCount\":1327,\"commentCount\":0,\"image\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/copy-master-record-into-separate-table-with-related-details\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/11\\\/Coipy-Master-Details-Title.png\",\"keywords\":[\"copy master details\",\"master record\",\"online database\",\"related details\",\"relation\",\"relational database\"],\"articleSection\":[\"Tips &amp; Tricks\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/copy-master-record-into-separate-table-with-related-details\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/copy-master-record-into-separate-table-with-related-details\\\/\",\"url\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/copy-master-record-into-separate-table-with-related-details\\\/\",\"name\":\"Copy Master record into a separate table and generate copies of related Details - TeamDesk Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/copy-master-record-into-separate-table-with-related-details\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/copy-master-record-into-separate-table-with-related-details\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/11\\\/Coipy-Master-Details-Title.png\",\"datePublished\":\"2018-11-27T16:02:49+00:00\",\"dateModified\":\"2021-09-28T09:59:13+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/#\\\/schema\\\/person\\\/63bd8646f2f4720f503116e38a190a6e\"},\"description\":\"This example shows how to create a custom button to generate Invoice records from existing Orders and copy order Items as related details.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/copy-master-record-into-separate-table-with-related-details\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/copy-master-record-into-separate-table-with-related-details\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/copy-master-record-into-separate-table-with-related-details\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/11\\\/Coipy-Master-Details-Title.png\",\"contentUrl\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/wp-content\\\/uploads\\\/2018\\\/11\\\/Coipy-Master-Details-Title.png\",\"width\":971,\"height\":575,\"caption\":\"Copy master & details\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/tips-tricks\\\/copy-master-record-into-separate-table-with-related-details\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"Copy Master record into a separate table and generate copies of related Details\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/\",\"name\":\"TeamDesk Blog\",\"description\":\"\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/#\\\/schema\\\/person\\\/63bd8646f2f4720f503116e38a190a6e\",\"name\":\"Mila\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/939a25c18364af1ceffe1d698a8fd01e1a18d8e1cf906fe3a6ac1cad64bc653f?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/939a25c18364af1ceffe1d698a8fd01e1a18d8e1cf906fe3a6ac1cad64bc653f?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/939a25c18364af1ceffe1d698a8fd01e1a18d8e1cf906fe3a6ac1cad64bc653f?s=96&d=mm&r=g\",\"caption\":\"Mila\"},\"url\":\"https:\\\/\\\/www.teamdesk.net\\\/blog\\\/author\\\/mila\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"Copy Master record into a separate table and generate copies of related Details - TeamDesk Blog","description":"This example shows how to create a custom button to generate Invoice records from existing Orders and copy order Items as related details.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/copy-master-record-into-separate-table-with-related-details\/","og_locale":"en_US","og_type":"article","og_title":"Copy Master record into a separate table and generate copies of related Details - TeamDesk Blog","og_description":"This example shows how to create a custom button to generate Invoice records from existing Orders and copy order Items as related details.","og_url":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/copy-master-record-into-separate-table-with-related-details\/","og_site_name":"TeamDesk Blog","article_published_time":"2018-11-27T16:02:49+00:00","article_modified_time":"2021-09-28T09:59:13+00:00","og_image":[{"width":971,"height":575,"url":"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Coipy-Master-Details-Title.png","type":"image\/png"}],"author":"Mila","twitter_card":"summary_large_image","twitter_misc":{"Written by":"Mila","Est. reading time":"9 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/copy-master-record-into-separate-table-with-related-details\/#article","isPartOf":{"@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/copy-master-record-into-separate-table-with-related-details\/"},"author":{"name":"Mila","@id":"https:\/\/www.teamdesk.net\/blog\/#\/schema\/person\/63bd8646f2f4720f503116e38a190a6e"},"headline":"Copy Master record into a separate table and generate copies of related Details","datePublished":"2018-11-27T16:02:49+00:00","dateModified":"2021-09-28T09:59:13+00:00","mainEntityOfPage":{"@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/copy-master-record-into-separate-table-with-related-details\/"},"wordCount":1327,"commentCount":0,"image":{"@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/copy-master-record-into-separate-table-with-related-details\/#primaryimage"},"thumbnailUrl":"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Coipy-Master-Details-Title.png","keywords":["copy master details","master record","online database","related details","relation","relational database"],"articleSection":["Tips &amp; Tricks"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.teamdesk.net\/blog\/tips-tricks\/copy-master-record-into-separate-table-with-related-details\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/copy-master-record-into-separate-table-with-related-details\/","url":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/copy-master-record-into-separate-table-with-related-details\/","name":"Copy Master record into a separate table and generate copies of related Details - TeamDesk Blog","isPartOf":{"@id":"https:\/\/www.teamdesk.net\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/copy-master-record-into-separate-table-with-related-details\/#primaryimage"},"image":{"@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/copy-master-record-into-separate-table-with-related-details\/#primaryimage"},"thumbnailUrl":"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Coipy-Master-Details-Title.png","datePublished":"2018-11-27T16:02:49+00:00","dateModified":"2021-09-28T09:59:13+00:00","author":{"@id":"https:\/\/www.teamdesk.net\/blog\/#\/schema\/person\/63bd8646f2f4720f503116e38a190a6e"},"description":"This example shows how to create a custom button to generate Invoice records from existing Orders and copy order Items as related details.","breadcrumb":{"@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/copy-master-record-into-separate-table-with-related-details\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.teamdesk.net\/blog\/tips-tricks\/copy-master-record-into-separate-table-with-related-details\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/copy-master-record-into-separate-table-with-related-details\/#primaryimage","url":"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Coipy-Master-Details-Title.png","contentUrl":"https:\/\/www.teamdesk.net\/blog\/wp-content\/uploads\/2018\/11\/Coipy-Master-Details-Title.png","width":971,"height":575,"caption":"Copy master & details"},{"@type":"BreadcrumbList","@id":"https:\/\/www.teamdesk.net\/blog\/tips-tricks\/copy-master-record-into-separate-table-with-related-details\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.teamdesk.net\/blog\/"},{"@type":"ListItem","position":2,"name":"Copy Master record into a separate table and generate copies of related Details"}]},{"@type":"WebSite","@id":"https:\/\/www.teamdesk.net\/blog\/#website","url":"https:\/\/www.teamdesk.net\/blog\/","name":"TeamDesk Blog","description":"","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.teamdesk.net\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/www.teamdesk.net\/blog\/#\/schema\/person\/63bd8646f2f4720f503116e38a190a6e","name":"Mila","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/939a25c18364af1ceffe1d698a8fd01e1a18d8e1cf906fe3a6ac1cad64bc653f?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/939a25c18364af1ceffe1d698a8fd01e1a18d8e1cf906fe3a6ac1cad64bc653f?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/939a25c18364af1ceffe1d698a8fd01e1a18d8e1cf906fe3a6ac1cad64bc653f?s=96&d=mm&r=g","caption":"Mila"},"url":"https:\/\/www.teamdesk.net\/blog\/author\/mila\/"}]}},"_links":{"self":[{"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/posts\/1648","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/comments?post=1648"}],"version-history":[{"count":13,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/posts\/1648\/revisions"}],"predecessor-version":[{"id":2498,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/posts\/1648\/revisions\/2498"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/media\/1683"}],"wp:attachment":[{"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/media?parent=1648"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/categories?post=1648"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.teamdesk.net\/blog\/wp-json\/wp\/v2\/tags?post=1648"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}