{"title":"Codeunit 1173 Document Attachment Mgmt, extension points 29","url":"https://jonas-paprotka.de/ref/codeunit/1173-document-attachment-mgmt/points/","author":"JOP-AL","license":"Metadata from Microsoft's symbol packages. AL source MIT, Copyright (c) Microsoft Corporation. Selection and wording © 2026 JOP-AL. https://jonas-paprotka.de/licenses/","subject":"Microsoft Dynamics 365 Business Central","checked":"2026-11-20","changed":"2026-11-04","object":{"type":"codeunit","id":1173,"name":"Document Attachment Mgmt","app":"Base Application","url":"https://jonas-paprotka.de/ref/codeunit/1173-document-attachment-mgmt/"},"major":29,"source":{"url":"https://jonas-paprotka.de/ref/codeunit/1173-document-attachment-mgmt/source/","path":"src/Layers/W1/BaseApp/Foundation/Attachment/DocumentAttachmentMgmt.Codeunit.al","commit":"4303e5e584d3aa5d9e98cbc615525a5396ad6ed7","lines":"a line is <source url>#L<line>"},"steps":{"event":"[line, \"event\", name, handled]: raises an event of this object; handled 1 when it has an IsHandled parameter","call":"[line, \"call\", name, arguments]: calls a procedure of this object","ext":"[line, \"ext\", type, id, name, arguments]: calls a procedure of another object, through a variable declared with that type","write":"[line, \"write\", table id, method, 1 when called with true]: Insert, Modify, ModifyAll, Delete, DeleteAll or Rename","validate":"[line, \"validate\", table id, field name]","run":"[line, \"run\", type, id]: Codeunit.Run, Page.Run, Report.Run and their kin"},"objects":{"table:1173":{"name":"Document Attachment","url":"https://jonas-paprotka.de/ref/table/1173-document-attachment/"},"codeunit:27":{"name":"Confirm Management","url":"https://jonas-paprotka.de/ref/codeunit/27-confirm-management/"},"codeunit:1511":{"name":"Notification Lifecycle Mgt.","url":"https://jonas-paprotka.de/ref/codeunit/1511-notification-lifecycle-mgt/"},"page:1173":{"name":"Document Attachment Details","url":"https://jonas-paprotka.de/ref/page/1173-document-attachment-details/"}},"procs":[{"name":"DeleteAttachedDocuments","line":43,"kind":"procedure","params":1,"steps":[[52,"call","SetDocumentAttachmentFiltersForRecRef",2],[53,"call","AttachedDocumentsExist",1],[54,"write",1173,"DeleteAll",1]]},{"name":"DeleteAttachedDocumentsWithConfirm","line":57,"kind":"procedure","params":1,"steps":[[62,"event","OnBeforeDeleteAttachedDocumentsWithConfirm",1],[66,"call","AttachedDocumentsExist",1],[67,"ext","codeunit",27,"GetResponseOrDefault",2],[68,"call","DeleteAttachedDocuments",1]]},{"name":"AttachedDocumentsExist","line":71,"kind":"procedure","params":1,"steps":[[80,"call","SetDocumentAttachmentFiltersForRecRef",2]]},{"name":"GetRefTable","line":98,"kind":"procedure","params":2,"steps":[[174,"event","OnAfterGetRefTable",0]]},{"name":"SetDocumentAttachmentRelatedFiltersForRecRef","line":178,"kind":"procedure","params":2,"steps":[[180,"call","SetDocumentAttachmentFiltersForRecRefInternal",3],[181,"event","OnAfterSetDocumentAttachmentFiltersForRecRef",0]]},{"name":"SetDocumentAttachmentFiltersForRecRef","line":184,"kind":"procedure","params":2,"steps":[[186,"call","SetDocumentAttachmentFiltersForRecRefInternal",3],[187,"event","OnAfterSetDocumentAttachmentFiltersForRecRef",0]]},{"name":"SetDocumentAttachmentFiltersForRecRefInternal","line":190,"kind":"procedure","access":"internal","params":3,"steps":[[200,"call","SetRelatedAttachmentsFilter",2],[204,"call","TableHasNumberFieldPrimayKey",2],[210,"call","TableHasDocTypePrimaryKey",2],[213,"call","TransformAttachmentDocumentTypeValue",2],[217,"call","TableHasLineNumberPrimaryKey",2],[223,"call","TableHasVATReportConfigCodePrimaryKey",2],[229,"event","OnAfterSetDocumentAttachmentFiltersForRecRefInternal",0]]},{"name":"SetRelatedAttachmentsFilter","line":232,"kind":"procedure","access":"local","params":2,"steps":[[249,"event","OnSetRelatedAttachmentsFilterOnBeforeSetTableIdFilter",0]]},{"name":"IsServiceDocumentFlow","line":283,"kind":"procedure","access":"internal","params":1,"steps":[[285,"event","OnAfterIsServiceDocumentFlow",0]]},{"name":"IsProductionDocumentFlow","line":288,"kind":"procedure","access":"internal","params":1,"steps":[[290,"event","OnAfterIsProductionDocumentFlow",0]]},{"name":"IsFlowFieldsEditable","line":293,"kind":"procedure","access":"internal","params":1,"steps":[[295,"call","TableIsDocument",1],[296,"event","OnAfterIsFlowFieldsEditable",0]]},{"name":"TableIsDocument","line":299,"kind":"procedure","access":"local","params":1,"steps":[[315,"event","OnAfterTableIsDocument",0]]},{"name":"TableHasNumberFieldPrimayKey","line":318,"kind":"procedure","access":"internal","params":2,"steps":[[357,"event","OnAfterTableHasNumberFieldPrimaryKey",0]]},{"name":"TableHasDocTypePrimaryKey","line":361,"kind":"procedure","access":"internal","params":2,"steps":[[377,"event","OnAfterTableHasDocTypePrimaryKey",0]]},{"name":"TableHasLineNumberPrimaryKey","line":381,"kind":"procedure","access":"internal","params":2,"steps":[[399,"event","OnAfterTableHasLineNumberPrimaryKey",0]]},{"name":"TransformAttachmentDocumentTypeValue","line":415,"kind":"procedure","access":"internal","params":2,"steps":[[417,"event","OnAfterTransformAttachmentDocumentTypeValue",0]]},{"name":"DeleteAttachedDocumentsOnAfterDeleteCustomer","line":464,"kind":"procedure","access":"local","params":2,"steps":[[469,"call","DeleteAttachedDocuments",1]]},{"name":"DeleteAttachedDocumentsOnAfterDeleteSalesHeader","line":473,"kind":"procedure","access":"local","params":2,"steps":[[478,"call","DeleteAttachedDocuments",1]]},{"name":"DeleteAttachedDocumentsOnAfterDeleteSalesLine","line":482,"kind":"procedure","access":"local","params":2,"steps":[[487,"call","DeleteAttachedDocuments",1]]},{"name":"DeleteAttachedDocumentsOnAfterDeleteSalesCreditMemoHeader","line":491,"kind":"procedure","access":"local","params":2,"steps":[[496,"call","DeleteAttachedDocuments",1]]},{"name":"DeleteAttachedDocumentsOnAfterDeleteSalesCreditMemoLine","line":500,"kind":"procedure","access":"local","params":2,"steps":[[505,"call","DeleteAttachedDocuments",1]]},{"name":"DeleteAttachedDocumentsOnAfterDeleteSalesInvoiceHeader","line":509,"kind":"procedure","access":"local","params":2,"steps":[[514,"call","DeleteAttachedDocuments",1]]},{"name":"DeleteAttachedDocumentsOnAfterDeleteSalesInvoiceLine","line":518,"kind":"procedure","access":"local","params":2,"steps":[[523,"call","DeleteAttachedDocuments",1]]},{"name":"DeleteAttachedDocumentsOnAfterDeletePurchInvHeader","line":527,"kind":"procedure","access":"local","params":2,"steps":[[532,"call","DeleteAttachedDocuments",1]]},{"name":"DeleteAttachedDocumentsOnAfterDeletePurchInvLine","line":536,"kind":"procedure","access":"local","params":2,"steps":[[541,"call","DeleteAttachedDocuments",1]]},{"name":"DeleteAttachedDocumentsOnAfterDeletePurchCreditMemoHeader","line":545,"kind":"procedure","access":"local","params":2,"steps":[[550,"call","DeleteAttachedDocuments",1]]},{"name":"DeleteAttachedDocumentsOnAfterDeletePurchCreditMemoLine","line":554,"kind":"procedure","access":"local","params":2,"steps":[[559,"call","DeleteAttachedDocuments",1]]},{"name":"DocAttachFlowFromSalesQuoteToSalesOrder","line":563,"kind":"procedure","access":"local","params":2,"steps":[[584,"call","CopyAttachments",2]]},{"name":"DocAttachFlowForSalesHeaderFromBlanketOrderToSalesOrder","line":588,"kind":"procedure","access":"local","params":2,"steps":[[609,"call","DeleteAttachedDocuments",1],[616,"call","CopyAttachments",2]]},{"name":"DocAttachFlowForSalesLinesFromBlanketOrderToSalesOrder","line":620,"kind":"procedure","access":"local","params":4,"steps":[[641,"call","DeleteAttachedDocuments",1],[647,"call","CopyAttachments",2]]},{"name":"DocAttachFlowForSalesHeaderFromSalesQuoteToSalesInvoice","line":651,"kind":"procedure","access":"local","params":2,"steps":[[672,"call","CopyAttachments",2]]},{"name":"DocAttachFlowForSalesLinesFromSalesQuoteToSalesInvoice","line":676,"kind":"procedure","access":"local","params":4,"steps":[[691,"call","CopyAttachments",2]]},{"name":"DocAttachFlowForSalesHeaderInsert","line":695,"kind":"procedure","access":"local","params":2,"steps":[[718,"call","CopyAttachments",2]]},{"name":"DocAttachFlowForSalesQuoteToSalesOrderSalesLines","line":722,"kind":"procedure","access":"local","params":4,"steps":[[737,"call","CopyAttachments",2]]},{"name":"DocAttachFlowForSalesHeaderCustomerChg","line":741,"kind":"procedure","access":"local","params":3,"steps":[[753,"call","DeleteAttachedDocumentsWithConfirm",1],[755,"call","DocAttachFlowForSalesHeaderInsert",2]]},{"name":"DocAttachFlowForCopyDocumentSalesHeader","line":759,"kind":"procedure","access":"local","params":2,"steps":[[761,"call","DocAttachFlowForSalesHeaderCustomerChg",3]]},{"name":"DocAttachFlowForSalesLineInsert","line":765,"kind":"procedure","access":"local","params":2,"steps":[[792,"call","CopyAttachments",2]]},{"name":"DocAttachFlowForSalesLineItemChg","line":796,"kind":"procedure","access":"local","params":3,"steps":[[808,"call","DeleteAttachedDocuments",1],[810,"call","DocAttachFlowForSalesLineInsert",2]]},{"name":"DocAttachForPostedSalesDocs","line":814,"kind":"procedure","access":"local","params":3,"steps":[[821,"event","OnBeforeDocAttachForPostedSalesDocs",1],[843,"call","CopyAttachmentsForPostedDocs",2]]},{"name":"DocAttachForPostedPurchaseDocs","line":847,"kind":"procedure","access":"local","params":4,"steps":[[854,"event","OnBeforeDocAttachForPostedPurchaseDocs",1],[875,"call","CopyAttachmentsForPostedDocs",2],[880,"call","CopyAttachmentsForPostedDocs",2],[885,"call","CopyAttachmentsForPostedDocs",2]]},{"name":"DeleteAttachedDocumentsOnAfterDeleteVendor","line":890,"kind":"procedure","access":"local","params":2,"steps":[[895,"call","DeleteAttachedDocuments",1]]},{"name":"DeleteAttachedDocumentsOnAfterDeletePurchaseHeader","line":899,"kind":"procedure","access":"local","params":2,"steps":[[904,"call","DeleteAttachedDocuments",1]]},{"name":"DeleteAttachedDocumentsOnAfterDeletePurchaseLine","line":908,"kind":"procedure","access":"local","params":2,"steps":[[913,"call","DeleteAttachedDocuments",1]]},{"name":"DocAttachFlowForPurchaseHeaderInsert","line":917,"kind":"procedure","access":"local","params":2,"steps":[[940,"call","CopyAttachments",2]]},{"name":"DocAttachFlowForPurchaseHeaderVendorChange","line":944,"kind":"procedure","access":"local","params":3,"steps":[[956,"call","DeleteAttachedDocumentsWithConfirm",1],[958,"call","DocAttachFlowForPurchaseHeaderInsert",2]]},{"name":"DocAttachFlowForCopyDocumentPurchHeader","line":962,"kind":"procedure","access":"local","params":2,"steps":[[964,"call","DocAttachFlowForPurchaseHeaderVendorChange",3]]},{"name":"DocAttachFlowForPurchaseLineInsert","line":968,"kind":"procedure","access":"local","params":2,"steps":[[989,"call","CopyAttachments",2]]},{"name":"DocAttachFlowForPurchaseLineItemChg","line":993,"kind":"procedure","access":"local","params":3,"steps":[[1005,"call","DeleteAttachedDocuments",1],[1007,"call","DocAttachFlowForPurchaseLineInsert",2]]},{"name":"DocAttachFlowForPurchQuoteToPurchOrder","line":1011,"kind":"procedure","access":"local","params":2,"steps":[[1032,"call","CopyAttachments",2]]},{"name":"DocAttachFlowForPurchQuoteToPurchOrderLines","line":1036,"kind":"procedure","access":"local","params":2,"steps":[[1051,"call","CopyAttachments",2]]},{"name":"DocAttachFlowForBlanketPurchaseHeader","line":1055,"kind":"procedure","access":"local","params":2,"steps":[[1076,"call","DeleteAttachedDocuments",1],[1083,"call","CopyAttachments",2]]},{"name":"DocAttachFlowForBlanketPurchaseLine","line":1087,"kind":"procedure","access":"local","params":4,"steps":[[1108,"call","DeleteAttachedDocuments",1],[1114,"call","CopyAttachments",2]]},{"name":"DeleteAttachedDocumentsOnAfterDeleteItem","line":1118,"kind":"procedure","access":"local","params":2,"steps":[[1123,"call","DeleteAttachedDocuments",1]]},{"name":"DeleteAttachedDocumentsOnAfterDeleteResource","line":1127,"kind":"procedure","access":"local","params":2,"steps":[[1132,"call","DeleteAttachedDocuments",1]]},{"name":"DeleteAttachedDocumentsOnAfterDeleteJob","line":1136,"kind":"procedure","access":"local","params":2,"steps":[[1141,"call","DeleteAttachedDocuments",1]]},{"name":"DeleteAttachedDocumentsOnAfterDeleteEmployee","line":1145,"kind":"procedure","access":"local","params":2,"steps":[[1150,"call","DeleteAttachedDocuments",1]]},{"name":"DeleteAttachedDocumentsOnAfterDeleteFixedAsset","line":1154,"kind":"procedure","access":"local","params":2,"steps":[[1159,"call","DeleteAttachedDocuments",1]]},{"name":"DeleteAttachedDocumentsOnAfterDeleteOpportunity","line":1163,"kind":"procedure","access":"local","params":2,"steps":[[1168,"call","DeleteAttachedDocuments",1]]},{"name":"MoveAttachedDocumentsOnAfterRenameCustomer","line":1172,"kind":"procedure","access":"local","params":3,"steps":[[1181,"call","MoveAttachmentsWithinSameRecordType",2]]},{"name":"MoveAttachedDocumentsOnAfterRenameVendor","line":1185,"kind":"procedure","access":"local","params":3,"steps":[[1194,"call","MoveAttachmentsWithinSameRecordType",2]]},{"name":"MoveAttachedDocumentsOnAfterRenameItem","line":1198,"kind":"procedure","access":"local","params":3,"steps":[[1207,"call","MoveAttachmentsWithinSameRecordType",2]]},{"name":"MoveAttachedDocumentsOnAfterRenameEmployee","line":1211,"kind":"procedure","access":"local","params":3,"steps":[[1220,"call","MoveAttachmentsWithinSameRecordType",2]]},{"name":"MoveAttachedDocumentsOnAfterRenameFixedAsset","line":1224,"kind":"procedure","access":"local","params":3,"steps":[[1233,"call","MoveAttachmentsWithinSameRecordType",2]]},{"name":"MoveAttachedDocumentsOnAfterRenameResource","line":1237,"kind":"procedure","access":"local","params":3,"steps":[[1246,"call","MoveAttachmentsWithinSameRecordType",2]]},{"name":"MoveAttachedDocumentsOnAfterRenameJob","line":1250,"kind":"procedure","access":"local","params":3,"steps":[[1259,"call","MoveAttachmentsWithinSameRecordType",2]]},{"name":"MoveAttachedDocumentsOnAfterRenameOpportunity","line":1263,"kind":"procedure","access":"local","params":3,"steps":[[1272,"call","MoveAttachmentsWithinSameRecordType",2]]},{"name":"IsDuplicateFile","line":1276,"kind":"procedure","params":6,"steps":[[1286,"event","OnIsDuplicateFileOnAfterSetFilters",0]]},{"name":"CopyAttachments","line":1304,"kind":"procedure","params":2,"steps":[[1320,"event","OnBeforeCopyAttachments",0],[1362,"event","OnCopyAttachmentsOnAfterSetFromParameters",0],[1379,"event","OnCopyAttachmentsOnAfterSetDocumentFlowFilter",0],[1406,"event","OnCopyAttachmentsOnAfterSetToParameters",0],[1409,"call","SkipDuplicateToDocumentAttachmentIDOnCopyFromOrderToInvoice",6],[1414,"validate",1173,"Table ID"],[1415,"validate",1173,"No."],[1420,"validate",1173,"Document Type"],[1424,"validate",1173,"Document Type"],[1425,"validate",1173,"Line No."],[1428,"event","OnCopyAttachmentsOnAfterSetToDocumentFilters",0],[1430,"write",1173,"Insert",1],[1437,"write",1173,"Modify"]]},{"name":"SkipDuplicateToDocumentAttachmentIDOnCopyFromOrderToInvoice","line":1446,"kind":"procedure","access":"local","params":6,"steps":[[1454,"call","TableIsDocumentHeader",1],[1463,"call","TableIsDocumentLine",1]]},{"name":"TableIsDocumentHeader","line":1480,"kind":"procedure","access":"local","params":1,"steps":[[1483,"event","OnAfterTableIsDocumentHeader",0]]},{"name":"TableIsDocumentLine","line":1486,"kind":"procedure","access":"local","params":1,"steps":[[1489,"event","OnAfterTableIsDocumentLine",0]]},{"name":"CopyAttachmentsForPostedDocs","line":1492,"kind":"procedure","params":2,"steps":[[1504,"event","OnBeforeCopyAttachmentsForPostedDocsLines",1],[1512,"call","TransformAttachmentDocumentTypeValue",2],[1525,"validate",1173,"Table ID"],[1529,"validate",1173,"No."],[1530,"call","SetDocumentTypeForPostedDocument",2],[1531,"event","OnCopyAttachmentsForPostedDocsOnBeforeToDocumentAttachmentInsert",0],[1532,"write",1173,"Insert",1],[1533,"event","OnCopyAttachmentsForPostedDocsOnAfterToDocumentAttachmentInsert",0],[1536,"call","CopyAttachmentsForPostedDocsLines",2]]},{"name":"CopyAttachmentsForPostedDocsLines","line":1539,"kind":"procedure","params":2,"steps":[[1555,"call","TransformAttachmentDocumentTypeValue",2],[1569,"event","OnCopyAttachmentsForPostedDocsLinesOnAfterSetFromFilters",0],[1575,"validate",1173,"Table ID"],[1577,"validate",1173,"Table ID"],[1579,"validate",1173,"Table ID"],[1581,"validate",1173,"Table ID"],[1583,"event","OnCopyAttachmentsForPostedDocsLinesOnAfterSetToTableID",0],[1585,"call","SetDocumentTypeForPostedDocument",2],[1586,"validate",1173,"No."],[1588,"write",1173,"Insert",1]]},{"name":"SetDocumentTypeForPostedDocument","line":1592,"kind":"procedure","access":"local","params":2,"steps":[[1596,"event","OnBeforeSetDocumentTypeForPostedDocument",1],[1603,"validate",1173,"Document Type"],[1606,"validate",1173,"Document Type"]]},{"name":"MoveAttachmentsWithinSameRecordType","line":1612,"kind":"procedure","params":2,"steps":[[1628,"call","TableIsEntity",1],[1647,"validate",1173,"No."],[1648,"event","OnMoveAttachmentsWithinSameRecordTypeOnBeforeInsert",0],[1649,"write",1173,"Insert",1],[1653,"write",1173,"DeleteAll",1]]},{"name":"TableIsEntity","line":1656,"kind":"procedure","access":"local","params":1,"steps":[[1668,"event","OnAfterTableIsEntity",0]]},{"name":"ShowNotification","line":1671,"kind":"procedure","params":3,"steps":[[1674,"call","ShowDocPrintedToAttachmentNotification",2],[1676,"call","ShowNotFoundPrintableReportsNotification",1]]},{"name":"ShowDocPrintedToAttachmentNotification","line":1679,"kind":"procedure","params":2,"steps":[[1687,"ext","table",1173,"InitFieldsFromRecRef",1],[1688,"call","GetNotificationId",0],[1696,"ext","codeunit",1511,"SendNotificationWithAdditionalContext",3],[1697,"call","GetNotificationId",0]]},{"name":"ShowNotFoundPrintableReportsNotification","line":1700,"kind":"procedure","params":1,"steps":[[1708,"ext","table",1173,"InitFieldsFromRecRef",1],[1709,"call","GetNoPritableReportsNotificationId",0],[1712,"ext","codeunit",1511,"SendNotification",2]]},{"name":"ShowDocumentAttachments","line":1725,"kind":"procedure","params":1,"steps":[[1738,"run","page",1173]]},{"name":"DeleteAttachedDocuments","line":1741,"kind":"procedure","params":2,"steps":[[1747,"call","DeleteAttachedDocumentsWithConfirm",1]]}]}