{"title":"Record.Copy(Record [, Boolean]) Method","url":"https://jonas-paprotka.de/docs/dev-itpro/developer/methods-auto/record/record-copy-method/","by":"JOP-AL","license":"Copyright (c) Microsoft Corporation. CC BY 4.0, https://creativecommons.org/licenses/by/4.0/; code samples MIT. From https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/record/record-copy-method, MicrosoftDocs/dynamics365smb-devitpro-pb at 828b6ee (2026-11-19). Changed: includes filled in, links to this site, and for agents shortened without dropping a fact.","credit":"Microsoft Corporation, CC BY 4.0","origin":"https://learn.microsoft.com/en-us/dynamics365/business-central/dev-itpro/developer/methods-auto/record/record-copy-method","source":{"name":"Business Central developer and IT pro docs","repo":"https://github.com/MicrosoftDocs/dynamics365smb-devitpro-pb","commit":"828b6ee72fcd75755627cd6011f3d20899217ab2","date":"2026-11-19"},"checked":"2026-11-19","description":"Copies a specified record's filters, views, automatically calculated FlowFields, marks, fields, and keys that are associated with the record from a table or creates a reference to a record.","date":"2026-10-01","meta":{"topic":"reference"},"outline":[{"level":1,"title":"Record.Copy(Record [, Boolean]) Method","slug":"recordcopyrecord-boolean-method","at":0,"chars":3542},{"level":2,"title":"Syntax","slug":"syntax","at":291,"chars":77},{"level":2,"title":"Parameters","slug":"parameters","at":368,"chars":720},{"level":2,"title":"Remarks","slug":"remarks","at":1088,"chars":1585},{"level":3,"title":"Copy from a temporary record to a non-temporary record","slug":"copy-from-a-temporary-record-to-a-non-temporary-record","at":1888,"chars":785},{"level":2,"title":"Example","slug":"example","at":2673,"chars":735},{"level":2,"title":"Related information","slug":"related-information","at":3408,"chars":134}],"text":"# Record.Copy(Record [, Boolean]) Method\n> Version: _Available or changed with runtime version 1.0._\nCopies a specified record's filters, views, automatically calculated FlowFields, marks, fields, and keys that are associated with the record from a table or creates a reference to a record.\n## Syntax\n```al\n Record.Copy(FromRecord: Record [, ShareTable: Boolean])\n```\n## Parameters\nRecord\nType: record-data-type\nAn instance of the record-data-type data type.\nFromRecord\nType: record-data-type\nThe record to copy.\n*[Optional] ShareTable*\nType: ../boolean/boolean-data-type\nSpecifies whether the method copies filters, views, automatically calculated FlowFields, marks, fields, and keys of the record or creates a reference to a temporary record. If FromRecord and Record are both temporary and ShareTable is true, then the COPY method causes Record to reference the same table as FromRecord. If ShareTable is true, then both Record and FromRecord must be temporary; otherwise an error will occur. The default value is false. If you specify false, only filters, marks, and keys are copied.\n## Remarks\nThe behavior of the Copy method depends on the ShareTable parameter and whether the source and target records are temporary:\n ShareTable is false (default): The method copies the current record's field values, filters, sorting, marks, field load info, read behavior, and automatically calculated FlowFields from the source record to the target record. The two records are fully independent afterward - changes to one don't affect the other. This works regardless of whether the source or target is temporary.\n ShareTable is true: The method shares the underlying temporary table data between the source and target records so that both records point to the same in-memory data. Both the source and target records must be temporary. If either record isn't temporary, a runtime error occurs.\n### Copy from a temporary record to a non-temporary record\nWhen you call Copy with the default ShareTable value of false, copying from a temporary record to a non-temporary record is fully supported. The target record receives the current field values, filters, marks, and keys from the temporary source record. Because ShareTable is false, no table data reference is shared - the target record gets an independent copy of the buffer.\nIf you set ShareTable to true in this scenario, a runtime error occurs because the target record isn't temporary.\n> NOTE\n> When copying from a temporary record to a non-temporary record (or vice versa), the result set enumerator is invalidated on the target record. Any active FindSet or Find loop on the target record won't continue after the copy.\n## Example\nThis example shows how to copy a record and its filters from a temporary record to a non-temporary record.\n```al\nprocedure CopyFromTemp()\nvar\n    TempCustomer: Record Customer temporary;\n    Customer: Record Customer;\nbegin\n    TempCustomer.SetRange(\"Country/Region Code\", 'US');\n    TempCustomer.SetFilter(Name, '@*Adatum*');\n\n    // Copies field values, filters, marks, and keys from the temporary record.\n    Customer.Copy(TempCustomer);\n\n    // Customer now has the same filters and field values.\n    // Use FindSet to query the database with the copied filters.\n    if Customer.FindSet() then\n        repeat\n            // Process non-temporary records matching the filters.\n        until Customer.Next() = 0;\nend;\n```\n## Related information\nrecord-data-type\nGet Started with AL<../../devenv-get-started>\nDeveloping Extensions<../../devenv-dev-overview>"}