Skip to main content

Pattern A — TransferFields Table Map

Use this map when the source table is one of the tables below. BC standard posting codeunits call TransferFields internally, so adding the custom field with the same Field ID to every target table extension is sufficient — no event subscriber code is needed.

How to confirm Pattern A applies

Open the BC source codeunit responsible for posting the document (e.g., "Sales-Post", "Purch.-Post", "TransferOrder-Post"). Look for a TransferFields call between the source record and the posted record. If it exists, you are in Pattern A.


Sales Header (Table 36)

Target Table IDTarget Table NamePosting Codeunit
110Sales Shipment HeaderSales-Post (80)
112Sales Invoice HeaderSales-Post (80)
114Sales Cr.Memo HeaderSales-Post (80)
6660Return Receipt HeaderSales-Post (80)
5107Sales Header ArchiveArchiveManagement (5063)

Sales Line (Table 37)

Target Table IDTarget Table NamePosting Codeunit
111Sales Shipment LineSales-Post (80)
113Sales Invoice LineSales-Post (80)
115Sales Cr.Memo LineSales-Post (80)
6661Return Receipt LineSales-Post (80)
5108Sales Line ArchiveArchiveManagement (5063)

Purchase Header (Table 38)

Target Table IDTarget Table NamePosting Codeunit
120Purch. Rcpt. HeaderPurch.-Post (90)
122Purch. Inv. HeaderPurch.-Post (90)
124Purch. Cr. Memo Hdr.Purch.-Post (90)
6650Return Shipment HeaderPurch.-Post (90)
5109Purchase Header ArchiveArchiveManagement (5063)

Purchase Line (Table 39)

Target Table IDTarget Table NamePosting Codeunit
121Purch. Rcpt. LinePurch.-Post (90)
123Purch. Inv. LinePurch.-Post (90)
125Purch. Cr. Memo LinePurch.-Post (90)
6651Return Shipment LinePurch.-Post (90)
5110Purchase Line ArchiveArchiveManagement (5063)

Transfer Header (Table 5740)

Target Table IDTarget Table NamePosting Codeunit
5744Transfer Shipment HeaderTransferOrder-Post (5704)
5746Transfer Receipt HeaderTransferOrder-Post (5704)

Transfer Line (Table 5741)

Target Table IDTarget Table NamePosting Codeunit
5745Transfer Shipment LineTransferOrder-Post (5704)
5747Transfer Receipt LineTransferOrder-Post (5704)

Anti-Pattern Warning

If the source and all target table extensions share the same Field ID, and you also have an EventSubscriber that manually copies that field, the subscriber is redundant. Delete the subscriber — TransferFields already copies the value. Having both causes double-assignment and makes the code harder to maintain.

// ❌ Redundant — TransferFields already copies field 50100 automatically
[EventSubscriber(ObjectType::Codeunit, Codeunit::"Sales-Post", 'OnAfterSalesInvLineInsert', '', false, false)]
local procedure CopyCustomField(var SalesInvoiceLine: Record "Sales Invoice Line"; SalesLine: Record "Sales Line")
begin
SalesInvoiceLine.MyCustomField := SalesLine.MyCustomField; // unnecessary
end;